Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 180 of 909
ADTS=100 'Set target synchronized accel/decel
VTS=100000 'Set target synchronized velocity
WHILE B(0,2):1|B(0,2):2|B(0,2):3 'Loop while motion in any axis
WAIT=10 'Allow time for other CAN communications
LOOP 'Loop back
x=1000 y=2000 z=3500 GOSUB10 'Put positions into variables
x=2200 y=1800 z=1200 GOSUB10 'Put positions into variables
x=1500 y=2600 z=2500 GOSUB10 'Put positions into variables
x=-120 y=1000 z=1500 GOSUB10 'Put positions into variables
x=0 y=0 z=0 GOSUB10 'Put positions into variables
END 'End Program
C10 'Place label
PTS(x;1,y;2,z;3) 'Set next positions, axes 1, 2 & 3
'and do this while the previous move
'is in progress
WHILE B(7,15)==1 'While synchronized move in process
'If one motor faults, stop all and end program -
IF B(0,0):1==0 MTB:0 ENDIF '*note
IF B(0,0):2==0 MTB:0 ENDIF '*note
IF B(0,0):3==0 MTB:0 ENDIF '*note
LOOP 'Loop back
GS 'Go, starts the synchronized move
RETURN 'Return to call
'*note: Managing faults is better done by using interrupts
'in other motors, taught later in this guide.
There is a note in the preceding example program stating that a better job can be done of
detecting and reacting to errors by using interrupts. This is true because the example, as
written, causes a considerable amount of unnecessary communications over the Combitronic
interface. By loading interrupt routines in each SmartMotor that constantly monitor for drive
status, each motor can be made responsible for reporting a local error. By this means, it is no
longer necessary to poll each motor. The motor controlling the synchronized motion can
simply do a quick check for reports right before issuing the next GS command. For more
details, see Interrupt Programming on page 192.
Part 1: Programming: TSWAIT