Flexible NC programming
1.12 Check structures
Job planning
Programming Manual, 07/2010, 6FC5398-2BP40-0BA0
103
R parameter as count variable:
Program code Comments
R11=6
FOR R10=R12-R20*R1 TO R11 ; Count variable = R parameter (real variable)
R20=R21*R22+R33
ENDFOR
M30
Example 2: Production of a fixed quantity of parts
Program code Comments
DEF INT WKPCCOUNT ; Defines type INT variable with the name
"WKPCCOUNT".
FOR WKPCCOUNT = 0 TO 100 ; Initiates the count loop. The "WKPCCOUNT"
variable increments from the initial value "0"
to the end value "100".
G01 …
ENDFOR ; End of count loop
M30
1.12.4 Program loop with condition at start of loop (WHILE, ENDWHILE)
Function
For a WHILE loop, the condition is at the beginning of the loop. The WHILE loop is executed
as long as the condition is fulfilled.
Syntax
WHILE <condition>
...
ENDWHILE
Significance
WHILE: Initiates the program loop.
ENDWHILE: Marks the end of the loop and results in a return jump to the beginning
of the loop.
<condition>: The condition must be fulfilled so that the WHILE loop is executed.