Parker Hannifin VIX500IM Stepper Machine User Manual


 
6. COMMAND REFERENCE 145
LOOP
Repeat user code
Syntax aLOOP(label,cycles)
Description The LOOP command repeatedly calls a labelled block of code a number of
times specified by the cycles parameter, the range being 0 to 65000. Note: If
the number of cycles is set to 0 the loop will continue indefinitely.
Nesting of loops up to 5 levels is permitted.
Properties
Immediate or buffered, can be used in labelled block, not saved by SV
Example
Run the grip code for a mechanical elasticity tester 6 times, and delay
for 1 second between each grip cycle to allows a sensor to measure
deflection.
2START: ; signifies this is the power on sequence
2DECLARE(GRIP)
2PROFILE2(150,200,4800,45)
2USE(2) ; Use motion parameters from profile 2
2LOOP(GRIP,6) ; repeat the grip/ungrip code 6 times
2END ;
2GRIP:
2G ; do the move on axis 2
2O(XX1) ; signal grip cycle
2T1 ; delay for one second
2H ; change to ungrip/grip
2G ; do the move again
2H ; change direction
2O(XX0) ; signal end grip cycle
2END
Note Also see the EXIT, KILL and GOSUB command.
If you use a GOTO command within a LOOP, it will stop program execution
of the loop and the number of nesting levels will be set to zero.
If you exceed the number of nesting levels the program will halt and
return a *E. R(UF) will return a Program nesting overflow message.