Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 803 of 909
EXAMPLE: (Routine pulses output on a given position)
EIGN(W,0) 'Disable limits
ZS 'Clear faults
ITR(0,4,0,0,1) 'ITR(int#,sw,bit,state,lbl)
ITRE 'Enable all interrupts
EITR(0) 'Enable interrupt 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
RELATED COMMANDS:
BREAK Break from CASE or WHILE Loop (see page 326)
IF formula Conditional Program Code Execution (see page 475)
LOOP Loop Back to WHILE Formula (see page 522)
SWITCH formula Switch, Program Flow Control (see page 727)
WHILE formula While Condition Program Flow Control (see page 801)
Part 2: Commands: WHILE formula