Moog Animatics SmartMotor™ Developer's Guide,Rev. L
Page 802 of 909
For example, the formula a=(b+2)*3 would be applied to a WHILE as:
WHILE((b+2)*3)!=0
LOOP
This is preferred to merely writing "WHILE(b+2)*3". The logical condition being tested is
more obvious when the comparison operators are used. It is also possible to combine multiple
logical tests when the comparison operators are used:
WHILE (a>(b+1))&(c!=d)
LOOP
This statement loops as long as "c" does not equal "d" and "a" is greater than "b+1".
If a BREAK command is encountered while executing a WHILE control block, program
execution unconditionally redirects to the program code following the LOOP statement. For
details, see BREAK on page 326.
EXAMPLE: (Routine stops motion if voltage drops)
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 'Required END
Part 2: Commands: WHILE formula