Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 265 of 909
EXAMPLE:
EIGN(W,0) 'Set all I/O as general inputs
a=0
ZS 'Clear all faults
Ai(0) 'Arm motor’s capture register
MV 'Set up slow velocity mode
VT=1000
ADT=10 'Set up accel/decel
G 'Start motion
WHILE Bt 'While trajectory
IF Bi(0)==0 'Check index capture of encoder
GOSUB(1) 'Call subroutine
ELSE
X
ENDIF 'End checking
LOOP 'Loop back
RI(0) 'Report rising edge
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
RELATED COMMANDS:
Aij(arg) Arm Index Rising Edge Then Falling Edge (see page 266)
Aj(arg) Arm Index Falling Edge (see page 268)
Aji(arg) Arm Index Falling Edge Then Rising Edge (see page 270)
R
Bi(enc) Bit, Index Capture, Rising (see page 304)
EIRE Enable Index Register, External-Input Capture (see page 412)
EIRI Enable Index Register, Internal-Input Capture (see page 414)
R
I(enc) Index, Rising-Edge Position (see page 471)
Part 2: Commands: Ai(arg)