Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 600 of 909
EXAMPLE: (Subroutine reports the status of the 24V expansion IO)
'This code reports the status of the 24V expansion IO
a=0 'Set loop start point for first IO
WHILE a<10 'While less than number of IO
b=a+16 'Set b to IO number for 24V expansion
c=OC(b) 'Set c to IO condition status
d=OF(b) 'Set d to IO fault status
PRINT("Output ",b," on pin ",a)
IF d==1 'If d represents overcurrent
PRINT(" is FAULTED overcurrent.",#13)
ELSEIF d==2 'If d represents a possible short
PRINT(" is FAULTED short.",#13)
ELSEIF c 'If c is true
PRINT(" is HIGH.",#13)
ELSE 'If c is not true
PRINT(" is LOW.",#13)
ENDIF
a=a+1 'Increment loop counter
LOOP
Program output is:
Output 16 on pin 0 is HIGH.
Output 17 on pin 1 is HIGH.
Output 18 on pin 2 is LOW.
Output 19 on pin 3 is LOW.
Output 20 on pin 4 is LOW.
Output 21 on pin 5 is LOW.
Output 22 on pin 6 is LOW.
Output 23 on pin 7 is LOW.
Output 24 on pin 8 is LOW.
Output 25 on pin 9 is LOW.
RELATED COMMANDS:
R
OF(...) Output Fault (see page 603)
OR(value) Output, Reset (see page 607)
OS(...) Output, Set (see page 609)
Part 2: Commands: OC(...)