beautypg.com

1 subprograms – HEIDENHAIN TNC 407 (280 580) User Manual User Manual

Page 176

background image

TNC 425/TNC 415 B/TNC 407

6-2

6

Subprograms and Program Section Repeats

6

Subprograms and Program Section Repeats

Subprograms and program section repeats enable you to program a
machining sequence once and then run it as often as you desire.

Labels

Subprograms and program section repeats are marked by labels.

A label is identified by a number between 0 and 254. Each label (except
for label number 0) can be used only once with LABEL SET in a program.

LABEL 0 marks the end of a subprogram.

6.1 Subprograms

Principle

The program is executed up to the block in which a
subprogram in called via CALL LBL (

1

).

The subprogram is then executed from beginning to
end (

2

). The subprogram end is marked with LBL

0.

The main program is then resumed from the block
after the subprogram call (

3

).

Operating limits

• A main program can hold up to 254 subpro-

grams.

• Subprograms can be called in any sequence and

as often as desired.

• A subprogram cannot call itself.
• Subprograms should be written at the end of the

main program (behind the block with M2 or
M30).

• If subprograms are located before the block with

M02 or M30, they will be executed at least once,
even if they are not called.

0

BEGIN PGM ...

CALL LBL 1

L Z + 100 M2
LBL 1

LBL 0
END PGM ...

1

2

3

.
.
.
.
.
.
.
.
.
.
.
.
.
.

R

S

Fig. 6.1:

Flow diagram for a subprogram run;

S

= jump

R

= return jump