![HEIDENHAIN TNC 407 User Manual Download Page 180](http://html1.mh-extra.com/html/heidenhain/tnc-407/tnc-407_user-manual_2118718180.webp)
TNC 426/TNC 425/TNC 415 B/TNC 407
6-2
6
Subprograms and Program Section Repeats
Fig. 6.1:
Flow diagram for subprogramming
S
= jump
R
= return jump
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 desired.
Labels
Subprograms and program section repeats are marked by labels.
A label is identified by a number between 0 and 254. Each label (except
label 0) can be set only once in a program. Labels are set with G98.
LABEL 0 marks the end of a subprogram.
6.1 Subprograms
Operating sequence
The main program is executed up to the block in
which a subprogram is called with Ln,0 (
1
).
The subprogram is then executed from beginning to
end (G98 L0) (
2
).
The main program is then resumed from the block
after the subprogram call (
3
).
Operating limitations
• A main program can contain up to 254
subprograms.
• 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 M02 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.
R
S
1
2
3
N1
% ... *
L1,0 *
Z + 100 M2 *
G98 L1 *
G98 L0 *
N99999
% ... *
.
.
.
.
.
.
.
.
.
.
.
.
.
.