Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 212 of 909
EIGN(W,0) 'Set all I/O to be general inputs a=0
ZS 'Clear all faults
Ai(0) 'Arm motor’s capture register
MV VT=1000 ADT=10 'Set up slow velocity mode, slow accel/decel
G 'Start motion
WHILE Bt 'While trajectory
IF Bi(0)==0 'Check index captured of encoder
GOSUB(1) 'Call subroutine
ELSE
X
ENDIF 'End checking
LOOP 'Loop back
OFF
END 'SUB 1: Increment a every 1 second
C1
IF B(4,0)==0 'Check Timer 0 status
a=a+1 'Updating a every second
TMR(0,1000) 'Set Timer 0 counting
ENDIF
RETURN
END
Timer Status Bits
Timer Status Bits are true while a timer is actively counting. Timers have resolution of 1
millisecond.
TMR(0,1000) Sets Timer Status bit 0 true for 1 second.
=TMR(3) Gets the value of Timer 3.
For more details, see Part 2: SmartMotor Command Reference on page 238.
Interrupt Status Bits
Interrupt Status Bits are true if an interrupt is enabled. It is important to note the interrupts
need to be configured before being enabled for proper operation. For details on configuring
interrupts, refer to Interrupt Programming on page 192.
The following commands would directly affect the state of the interrupt status bits:
ITRE Enables the interrupt handler, sets Interrupt Status Bit 15
ITRD Disables the interrupt handler, clears Interrupt Status Bit 15
EITR(0) Enables the highest priority interrupt, sets Interrupt Status Bit 0
DITR(0) Disables the highest priority interrupt, clears Interrupt Status Bit 0
For more details, see Part 2: SmartMotor Command Reference on page 238.
Part 1: Programming: Timer Status Bits