Programming manual.
CNC 8070
22.
STATEMENTS AND INSTRUCTIONS
Flow controlling instructions
·436·
(REF: 1709)
22.2.3 Conditional execution ($SWITCH)
$SWITCH <EXPRESSION1> ... $CASE<EXPRESSION2>
... $ENDSWITCH
The following parameters are defined in this instruction:
This instruction calculates the result of <expression1> and executes the blocks contained
between the $CASE instruction, whose <expression2> has the same value as the calculated
result and the corresponding $BREAK instruction.
The $SWITCH instruction always ends with a $ENDSWITCH.
The $CASE instruction always ends with a $BREAK. As many $CASE instructions as
necessary may be programmed.
As an option, a $DEFAULT instruction may be inserted in such a way that if the result of
<expression1> does not coincide with the value of any <expression2>, it executes the blocks
contained between $DEFAULT and $ENDSWITCH.
<expression> It may be a number, parameter or arithmetic expressing whose result is a number.
N20 $SWITCH [P1+P2/P4]
N30 $CASE 10
N40...
N50...
N60 $BREAK
N70 $CASE [P5+P6]
N80...
N90...
N100 $BREAK
N110 $DEFAULT
N120...
N130...
N140 $ENDSWITCH
N150...
If the result of the expression [P1+P2/P4].
• Is "10", it executes blocks N40 through N50. The execution continues at N150.
• Is equal to [P5+P6], it executes blocks N80 through N90. The execution continues at
N150.
• Is other than "10" and [P5+P6], it executes blocks N120 and N130. The execution
continues at N150.