Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 213 of 909
I/O Status
Typically, to get an I/O port logical status, you would use the IN() instructions for zero-based
addressing of the I/O Ports. As with any status of the SmartMotor, you can also retrieve the
I/O port status, but not change its state, using the W() and B() status word/bit commands.
IN() Get I/O input
W() Get a specific status word
B() Get status bit
RIN(IO) Report the state of an I/O
RW(value) Report status word
RB(sw,b) Report status bit, b, from status word, sw
For more details, see Part 2: SmartMotor Command Reference on page 238.
User Status Bits
Status words 12 and 13 contain user status bits (status bits that can be set by the user). User
bits allow you to keep track of events or status within an application program. Their functions
are defined by the application program of the SmartMotor. User bits are addressed
individually starting at 0 (zero-based). Likewise, the user bits words are addressed starting at
0 (zero-based).
A powerful feature of user bits is their ability to be addressed over networks such as
Combitronic or CANopen. This feature allows a hosting application to cause a SmartMotor to
run an interrupt routine. For details, seeInterrupt Programming on page 192.
The user bits can also be addressed as words, with or without a mask, to define which bits are
affected. The following are examples of commands that directly effect the user bits.
US(0) Set user bit 0
US(W,0,a) Set first three user bits when a=7
UO(0)=a&b
Set user bit to 1 if the bit-wise operation result is odd, else set it to 0
UO(W,0)=x Set status word 12 to the value of x
UO(W,1)=123 Set status word 13 to the value 123
UO(W,1,7)=a Set user bits 16, 17 and 18 to the value of the lower three bits in a
UR(19) Reset user bit 3 in second user bit status word
UR(W,0) Reset all user bits in first user bit status word
UR(W,1,7) Reset user bits 16, 17 and 18
NOTE: The G command also resets several system state flags.
For more details, see Part 2: SmartMotor Command Reference on page 238.
Part 1: Programming: I/O Status