Programming manual
486
CNC 8070
15.
STATEMENTS AND INSTRUCTIONS
Flow controlling instructions
(SOFT V02.0X)
484
15.2.4 Block repetition ($FOR)
$FOR <n> = <expr1>,<expr2>,<expr3>... $ENDFOR
The following parameters are defined in this instruction.
When executing this instruction, <n> takes the value of <expr1> and
it changes its value up to the value of <expr2>, in steps indicated by
<expr3>. At each step, it executes the blocks contained between
$FOR and $ENDFOR.
The $BREAK instruction lets ending block repetition even if the stop
condition is not met. The execution of the program will continue at the
block after $ENDFOR.
The $CONTINUE instruction starts the next repetition even when the
current one has not finished. The blocks programmed after
$CONTINUE up to $ENDFOR will be ignored in this repetition.
<n> It may be an arithmetic parameter of a write variable.
<expr> It may be a number, parameter or arithmetic expressing
whose result is a number.
...
N20 $FOR P1=0,10,2
N30...
N40...
N50...
N60 $ENDFOR
N70...
It executes blocks N30 through N50 from P1=0 until P1=10, in steps of 2
(thus 6 times).
...
N12 $FOR V.P.VAR_NAME=20,15,-1
N22...
N32...
N42 $ENDFOR
N52...
It executes blocks N22 through N32 in steps of -1 (thus 5 times) from
V.P.VAR_NAME=20 to V.P.VAR_NAME=15.
...
N20 $FOR P1= 1,10,1
N30...
N40 $IF P2==2
N50 $BREAK
N60 $ENDIF
N70...
N80 $ENDFOR
...
Block repetition stops if P1 is greater than 10, or if P2 = 2.