Sie sind auf Seite 1von 6

Servida I/O Control at a Glance

Topics covered in this section: page


I/O Port Hardware 2
Software Control of I/O Ports
Reading a Port as an Input
Assigning Port status to a variable 3
Reading a Port as an Analog value
Assigning a Port as an Output
Default States and special uses of I/O ports
Ports A and ! Defaults and Specifics
Ports A and B as quadrature encoder inputs
Ports A and B as Step and Direction inputs
Ports C and D Defaults and Specifics "
Ports # and $ Defaults and Specifics
Ports % Defaults and Specifics
I/O Progra&&ing e'a&ples (
)evel *riggered Subroutine call
Positive+#dge+*riggered Subroutine Call
,egative+#dge *riggered Subroutine Call
)evel and State C-ange Print+Out e'a&ple
1
Servida I/O Control at a Glance
There are seven I/O channels available on a Smart otor!
The" can be assigned as either Inputs# Outputs# or 1$ Bit analog inputs individuall"!
,ote. At an/ ti&e0 regardless of usage0 t-e ports &a/ be read as an analog value1
I/O Port Hardware
%ach I/O point has a 1$$ Ohm series current
limit resistor &ith a '(ohm pull)up!
%ach has a '!*+D, -ener diode as &ell!
%ach can sin. 1'mA and source /mA!
,O*#. *-e/ are not open collector P or , t/pe outputs2 *-e/ are *ote& Pole C3OS
driven outputs1 4-en assigned as outputs t-e/ drive -ard to eit-er "5DC or %round
w-en set to a 6 or 7 respectivel/
It is possible to use an Open ,ollector 0P0 t"pe 1/+D, pro2 &ith the Servidas!
*-e 8se of P,P sourcing t/pe 25DC pro' switc-es will da&age t-e Servida2
Dr" contacts# i3 used# should be &ired 3rom the port pin to ground!
I3 "ou &ire them 3rom the port pin to '+D,# the pull up resistor &ill cause "ou to al&a"s see a
logic 1 on the port!
bac9 to top
Software Control of I/O Ports
This is an overvie& o3 Servida ,ode to control the on)board I/O:
In each case# 4 denotes an" port A through 5 and should be replaced &ith the port letter to be used!
Reading a Port as an Input.
64I : de3ines port 747 as an input port8 4 is an" port A)9
%2ample:
6AI &ould de3ine port 7A7 as an input port!
bac9 to top
1
Software Control of I/O Ports :continued;
Assigning Port status to a variable.
2<64I : assign the variable 727 the value at port 747!
: 2 &ill equal =1> i3 the port is at '+D,!
: 2 &ill equal =$> i3 the port is at $+D,!
: 2 can be an" variable a)-# aa)--# aaa)---!!
%2ample: "<6AI &ould assign the logic state o3 port A to the variable "!
bac. to top
Reading a Port as an Analog value.
2<64A : assigns the variable 727 a 1$ Bit analog value 3rom $ to 1$1? &here $ +D,<$
and '+D,<1$1?
This command reads the selected port via a 1$BIT A/D converter!
%2ample: -<6BA &ould assign the 1$)Bit analog value o3 port B to the variable -!
,ote. This is use3ul 3or sel3)diagnostics! B" placing a .no&n voltage dropping resistor on an
e2ternal s&itch or other device# "ou can use the port as a general input# and "et do an analog
read to chec. i3 the s&itch or sensor &ire ma" have become disconnected 3rom the port!
bac. to top
Assigning a Port as an Output.
64O : de3ines port 747 as output port
%2ample: 6%O &ould assign port B as an output!
64<1 : drives voltage on port 747 to ' +D,
%2ample: 6%<1 &ould set port % to '+D,!
64<$ : drives voltage on port 747 to $ +D,
%2ample: 6%<$ &ould set port % to $+D,!
,ote. @ou can pre)de3ine the state o3 a port prior to assigning it as an output!
Then "ou can toggle it bet&een input and output to change 3rom a driven state to a 3loating
state! This is use3ul &hen t"ing I/O together bet&een di33erent Servida otors!
bac. to top
?
Default States and special uses of I/O ports
Ports A and ! Defaults and Specifics.
Ports A and ! as :uadrature encoder inputs.
De3ault state: Ports A and B de3ault to phase A and B %ncoder Inputs!
I3 no Port ,ontrol commands have been issued to Ports A or B# at an" time#
"ou can use the ,TA command to get counter values 3rom these ports:
%2ample: A,TA &ould report counter status 3rom ports A and B
2<,TA &ould assign the counter value to the variable 2
9$ &ould re)set the counter to -ero! :ode 9ollo& Bero;
6sing 91# 91# 9/ or 9A &ill allo& "ou to ma.e use o3 ports A C B as quadrature encoder
input ports and place the otors into %lectronic gearing or ode 9ollo&!
See Delp 3iles or manual 3or more!
Ports A and ! as Step and Direction inputs.
The SO command re)sets the counter to -ero and sets up Ports A and B as Step and Direction inputs
respectivel"! Once doing so# the same rules appl" as listed above 3or the A,TA and ,TA commands!
Setting up the motor as a stepper via S# S$# or SA command &ill ma.e port A be a step
input and port B a direction input as &ell!
See Delp 3iles or manual 3or more!
,ote. S$ command is a good &a" o3 using port A as a high speed counter It -eros the ,ounter
&ithout changing the motorEs mode o3 operation! 9rom that point on# A,TA can report counts 3rom
pro2 s&itches# laser scanners etc!! as a high speed counter!
bac. to top
/
Default States and special uses of I/O ports :continued;
Ports C and D Defaults and Specifics.
Ports , and D de3ault to right and le3t limit inputs respectivel"! I3 the" are assigned as input or output
ports# the" must be rede3ined as limit s&itch inputs i3 "ou &ant them to be used as such! To rede3ine
them as limit inputs "ou do the 3ollo&ing:
%2ample: 6,P rede3ines port 7,7 as right limit input :P 3or plus rotation;
6D rede3ines port 7D7 as le3t limit input : 3or minus rotation;
Ports # and $ Defaults and Specifics.
Ports % and 9 can be used as the Anilin. port or an AS)/F' port! An" command used 3or
communication to Anilin.
devices &ill automaticall" set the ports as needed 3or Address and Data in3ormation!
6sing the O,D0 and O,DA commands &ith regards to AS)/F' usage &ill automaticall" set the ports
to hal3 duple2 AS)/F' operation!
See Delp 3iles or manual 3or more!
Ports % Defaults and Specifics.
B" De3ault# &hen port 5 sees a transition 3rom ' to -ero volts# it means the same as t"ping a 757 and
pressing enter or seeing a 5 in a program! This is &h" it is called the 5 S"nc pin!
This allo&s "ou to s"nchroni-e =goes> on multiple motors at the same time!
The 5 Port can be rede3ined as general I/O li.e the other ports!
65 : command returns Port 757 to de3ault s"nc port so i3 "ou assigned it as an input or output# To
rede3ine it as 75 s"nc7 simpl" invo.e the 65 command again!
Port 5 also has the option o3 being used as a handsha.e line 3or AS)1?1 to AS)/F' Adapters!
This is covered in the Delp 9iles and manual under communications!
bac. to top
'
I/O Progra&&ing e'a&ples
The 3ollo&ing are e2amples o3 triggering events o33 o3 Port I/O state changes!
)evel *riggered Subroutine call
This code causes subroutine 1$$ to be called &hen port A goes high
I9 6AI<<1
5OS6B1$$
%0DI9
Positive+#dge+*riggered Subroutine Call
This code causes subroutine 1$$ to be called &hen port A goes high
onl" a3ter 3irst going lo& :negative pulse triggered subroutine call;
I9 6AI<<$
GDIH% 6AI<<$
HOOP
5OS6B1$$
%0DI9
,egative+#dge *riggered Subroutine Call
This code causes subroutine 1$$ to be called &hen port A goes lo&
onl" a3ter 3irst going high :positive pulse triggered subroutine call;
I9 6AI<<1
GDIH% 6AI<<1
HOOP
5OS6B1$$
%0DI9
)evel and State C-ange Print+Out e'a&ple
GDIH% 1<<1 I&hile 3orever
GDIH% 6BI<<1 HOOP I&hile port B is high# do nothing
PAI0T:=Port B Just &ent Ho&>#K1?;
PAI0T:=Do nothing &hile it is Ho&>#K1?;
GDIH% 6BI<<$ HOOP I&hile port B is lo&# do nothing
PAI0T:=Port B Just &ent Digh>#K1?;
PAI0T:=Do nothing &hile it is Digh>#K1?;
HOOP
bac. to top
*

Das könnte Ihnen auch gefallen