Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 222 of 909
Multiple I/OFunctions Example
The following example shows multiple I/O functions:
EIGN(W,0) 'deactivate default on-board I/O functions
ab[10]=W(16) 'read the status of on-board I/O.
ab[11]=IN(W,0) 'Same as above, so ab[10]=ab[11] assuming
'I/O states didn’t change.
a=0
WHILE a<4
ab[a]=IN(a) 'get first 4 I/O states into ab[0]-ab[3]
a=a+1
LOOP
a=0
WHILE a<4
OS(a+4) 'turn ON I/O Ports 4 through 7.
a=a+1
LOOP
a=1
OUT(W,1)=aw[0] 'set expansion I/0 to value in aw[0]
OR(W,1,a) 'reset only I/O 16
END
EIGN(W,0) 'remove default on-board I/O functions
ab[10]=W(16) 'read the status of on-board I/O via
'controllers status word.
ab[11]=IN(W,0) 'same as above, so ab[10]=ab[11] assuming
'I/O states didn’t change.
a=0
WHILE a<4
ab[a]=IN(a) 'get first 4 I/O states into ab[0] through ab[3]
a=a+1
LOOP
a=0
WHILE a<4
OS(a+4) 'turn ON I/O ports 4 through 7.
a=a+1
LOOP
a=1
OUT(W,1)=aw[0] 'set expansion I/0 to value in aw[0]
OR(W,1,a) 'reset only I/O 16
END
Part 1: Programming: Multiple I/OFunctions Example