Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 744 of 909
EXAMPLE:
EIGN(2) 'Disable Left Limit
EIGN(3) 'Disable Right Limit
ZS 'Clear faults
MP 'Set Position Mode
VT=500000 'Set Target Velocity.
AT=300 'Set Target Acceleration.
DT=100 'Set Target Deceleration.
TMR(0,1000) 'Set Timer 0 to 1s
ITR(0,4,0,0,20) 'Set Interrupt
EITR(0) 'Enable Interrupt
ITRE 'Enable all Interrupts
p=0 'Initialize variable p
O=0 'Set commanded and actual pos. to zero
C10 'Place a label
IF PA>47000 'Just before 12 moves
DITR(0) 'Disable Interrupt
TWAIT 'Wait till reaches 48000
p=0 'Reset variable p
PT=p 'Set Target Position
G 'Start motion
TWAIT 'Wait for move to complete
EITR(0) 'Re-enable Interrupt
TMR(0,1000) 'Re-start timer
ENDIF GOTO10 'Go back to label
END 'End (never reached)
C20 'Interrupt Subroutine Label
TMR(0,1000) 'Re-start timer
p=p+4000 'Increment variable p
PT=p 'Set Target Position
G 'Start Motion
RETURNI 'Return to main loop
EXAMPLE: (for pulse width)
. . .
WHILE 1>0
O=0 'Reset origin for move
PT=40000 'Set final position
G 'Start motion
WHILE PA<20000 'Loop while motion continues
LOOP 'Wait for desired position to pass
OUT(1)=0 'Set output lo
TMR(0,400) 'Use timer 0 for pulse width
TWAIT WAIT=1000 'wait 1 second
LOOP
. . .
RELATED COMMANDS:
ITR(Int#,StatusWord,Bit#,BitState,Label#) Interrupt Setup (see page 486)
Part 2: Commands: TMR(timer,time)