Switch..case—program branching, 35 conditional bloc k run – HEIDENHAIN CNC Pilot 4290 V7.1 User Manual
Page 324

324
4.35 Conditional Bloc
k Run
SWITCH..CASE—program branching
The switch statement consists of the elements:
SWITCH, followed by a variable. The content of the variables is
interrogated in the following CASE instruction.
CASE x: The CASE branch is run with the variable value x. CASE can
be programmed repeated times.
DEFAULT: This branch is executed if no CASE instruction matched
the variable value. DEFAULT can be omitted.
BREAK: Concludes the CASE branch or DEFAULT branch
Programming:
U
Select “Instr. > DIN PLUS words” in the machining menu. The CNC
PILOT opens the “DIN PLUS words” selection list.
U
Select SWITCH
U
Enter the switch variable
U
For each CASE branch:
Select CASE (from the DIN PLUS words selection list)
Enter the SWITCH condition (value of the variable) and
insert the NC blocks to be executed.
U
For the DEFAULT branch: Insert the NC blocks to be executed.
V variables are included during simulation. The V variables can be
assigned values. Thus all branches of your NC program can be tested.
Example for V variables
Relational operators
<
Less than
<=
Less or equal
<>
Not equal to
>
Greater than
>=
Greater than or equal
==
Equal
Combining conditions:
AND
Logical AND operation
OR
Logical OR operation
You can combine up to two conditions.
If the branch is triggered by V variables or events, the
contour follow-up is switched off with the SWITCH
statement and back on with the ENDSWITCH
statement. With G702, G703 or G706 you control the
contour follow-up.
. . .
N.. SWITCH{V1}
N..
CASE 1
[EXECUTED IF V1=1]
Executed if V1=1
N.. G0
XI10
. . .
N..
BREAK
N..
CASE 2
[EXECUTED IF V1=2]
Executed if V1=2
N.. G0
XI20
. . .
N..
BREAK
N..
DEFAULT
No CASE instruction matched the variable value
N.. G0
XI30
. . .