Statements for influencing the NC program flow sequence

The syntax for control block statements is:

$<statement> 

<statement> Control block string acc. to the following chapters. Note that between $ and <statement> no blank characters are permissible.

Statements for influencing the program flow (control-block) enable the realization of:

In the use of control-block-statements, the following rules are valid:

Programming example

Syntax check in an invalid branch:

N10 $IF 0 
N20 XY (Here no syntax check takes place)
N30 $ENDIF
N10 $IF 0
N20 ...
N30 $IF XY (Syntax-check because of nested control-block-)
(statement; Error message because of the unknown term)
N40 ...
N50 $ENDIF
N60 $ENDIF
N10 $IF 0
NXY (Syntax check of block number;)
(Error message because of unknown term)
N30 $ENDIF

Because of inaccuracy in the calculation and internal representation of parameters, comparative operations in control-block-statements, could lead to an erroneous result (see Chapter 2.6.1.3: "Arithmetical expressions"). Therefore, in doubtful cases, checking should be made not for precise value but for a tolerance range.

Programming example

Wrong:

N10 $FOR P1 = 0, 10, 1 
N20 P2 = P2 + 0.01
N30 $ENDFOR
N40 $IF P2 == 0.1 (Due to inaccuracies of calculation P2)
N50 ... (can be unequal to 0.1, so that the $ELSE-)
N60 $ELSE (branch is executed)
N70 G04 X20
N80 $ENDIF

Correct:

N10 $FOR P1 = 0, 10, 1 
N20 P2 = P2 + 0.01
N30 $ENDFOR
N40 $IF [P1 - 0.1] <= .000001 (Verification of a tolerance range non-)
(problematical for NC manufacture;)
N50 G04 X5 ($IF-branch will be executed)
N60 $ELSE
N70 ...
N80 $ENDIF