Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 824 of 909
Move Back and Forth
This is a simple program used to set tuning parameters and create an infinite loop, which
causes the motor to move back and forth. Note the TWAIT commands that are used to pause
program execution during the moves.
EIGN(W,0) 'Disable hardware limits
ZS 'Clear faults
ADT=100 'Set maximum accel/decel
VT=1000000 'Set maximum velocity
MP 'Set Position mode
C10 'Place a label
PT=100000 'Set position
G 'Start motion
TWAIT 'Wait for move to complete
PT=0 'Set position
G 'Start motion
TWAIT 'Wait for move to complete
GOTO(10) 'Loop back to label 10
END 'Obligatory END (never reached)
Move Back and Forth with Watch
The following example is identical to the previous, except that instead of pausing program
execution during the move with the TWAIT, a subroutine is used to monitor for excessive load
during the moves. This is an important distinction — most SmartMotor programs should have
the ability to react to events during motion.
EIGN(W,0) 'Disable hardware limits
ZS 'Clear faults
ADT=100 'Set maximum accel/decel
VT=100000 'Set maximum velocity
MP 'Set Position mode
C1 'Place a label
PT=100000 'Set position
G 'Start motion
GOSUB(10) 'Call wait subroutine
PT=0 'Set position
G 'Start motion
GOSUB(10) 'Call wait subroutine
GOTO(1) 'Loop back to label 1
END 'Obligatory END (never reached)
' ****Subroutine****
C10
WHILE Bt 'Loop while trajectory in progress
IF ABS(EA)>100 'Test for excessive load
PRINT("Excessive Load",#13) 'Print warning
ENDIF 'End test
LOOP 'Loop back to While during motion
RETURN 'Return from subroutine
Part 3: Examples: Move Back and Forth