15 v a riable pr ogr amming – HEIDENHAIN CNC Pilot 4290 User Manual

Page 192

Advertising
background image

4 DIN PLUS

180

Example:

. . .

N.. IF {E1[16]==1}

N..THEN

N..

G0 X100 Z100

N.. ELSE

N..

G0 X0 Z0

N.. ENDIF

. . .

NC blocks with IF, THEN, ELSE, ENDIF

can have no further commands

For branches due to V variables or

events, the contour follow-up is switched
off with the IF statement and back on with
the ENDIF statement. With G703 you can
switch on the contour follow-up function.

4.15

V

a

riable Pr

ogr

amming

Example:

. . .

N.. WHILE (#4<10) AND (#5>=0)

N..

G0 Xi10

. . .

N.. ENDWHILE

. . .

If the repetition is made due to V

variables or events, the contour follow-up
function is switched off for the WHILE
branch and switched on again with
ENDWHILE. With G703 you can switch on
the contour follow-up function.

If the ”condition” you program in the

WHILE command is always true, the pro-
gram remains in an ”endless loop.” This is
one of the most frequent causes of error
when working with program repeats.

WHILE..ENDWHILE – program repeat

A ”program repeat” consists of the elements:

WHILE – followed by a condition. In the case of ”conditions”,

variables or mathematical expressions are defined to the left and to
the right of relational operators.

ENDWHILE – concludes the conditional program branch.

NC blocks programmed between WHILE and ENDWHILE are
executed repeatedly for as long as the ”condition” is fulfilled. If the
condition is not fulfilled, CNC PILOT continues execution of the
program with the block programmed after ENDWHILE.

Programming notes

Select WHILE (Machining menu: Instructions – DIN PLUS words)

Enter the desired condition (enter only the required brackets).

Insert NC blocks

IF..THEN..ELSE..ENDIF – program branches

A ”conditional branch” consists of the elements:

IF – followed by a condition. In the case of conditions, variables or

mathematical expressions are defined to the left and to the right of
relational operators.

THEN – when the condition is fulfilled, the THEN branch is

executed.

ELSE – when the condition is not fulfilled, the ELSE branch is

executed.

ENDIF – concludes the conditional program branch.

Programming notes

Select IF (Machining menu: Instructions – DIN PLUS words)

Enter the desired condition (only enter the required brackets).

Insert NC blocks of the THEN and ELSE branch – the ELSE branch

can be omitted

Advertising