Examples
Example 1: INTEGER variable or R parameter as count variable
INTEGER variable as count variable:
Program code Comment
DEF INT iVARIABLE1
R10=R12-R20*R1 R11=6
FOR iVARIABLE1 = R10 TO R11 ; Count variable = INTEGER variable
R20=R21*R22+R33
ENDFOR
M30
R parameter as count variable:
Program code Comment
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 Comment
DEF INT WKPCCOUNT ; Defines type INT variable with the name
"WKPCCOUNT".
FOR WKPCCOUNT = 0 TO 100 ; Initiates the count loop. The "WKPCCOUNT" vari-
able increments from the initial value "0" to the
end value "100".
G01 …
ENDFOR ; End of count loop
M30
3.1.7.4 Program loop with condition at start of loop (WHILE, ENDWHILE)
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
Work preparation
3.1 Flexible NC programming
NC programming
Programming Manual, 12/2019, 6FC5398-2EP40-0BA0 479