Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 832 of 909
EIGN(W,0) 'Disable limits
ZS
ITR(0,4,0,0,1) 'ITR(int#,sw,bit,state,lbl)
ITRE
EITR(0)
OUT(1)=1 'Set I(0)/O B to output, high
ADT=100 'Set maximum accel/decel
VT=100000 'Set maximum velocity
MP 'Set Position mode
'****Main Program Body****
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 low
TMR(0,400) 'Use timer 0 for pulse width
TWAIT
WAIT=1000 'Wait 1 second
LOOP
END
'****Interrupt Subroutine****
C1
OUT(1)=1 'Set output high again
RETURNI
Stop Motion if Voltage Drops
The voltage, current and temperature of a SmartMotor are always known. These values can
be used within a program to react to changes.
In this example, the SmartMotor begins a move and then stops motion if the voltage falls
below 18.5 volts.
EIGN(W,0) 'Disable hardware limits
ZS 'Clear faults
MDS 'Sine mode commutation
ADT=100 'Set maximum accel/decel
VT=100000 'Set maximum velocity
PT=1000000 'Set final position
MP 'Set Position mode
G 'Start motion
WHILE Bt 'Loop while motion continues
IF UJA<18500 'If voltage is below 18.5 volts
OFF 'Turn motor off
ENDIF
LOOP 'Loop back to WHILE
END 'Obligatory END
Part 3: Examples: Stop Motion if Voltage Drops