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