Subprograms and program section repeats, Subprograms -2, Principle -2 operating limits -2 – HEIDENHAIN TNC 360 ISO Programming User Manual
Page 125: 1 subprograms

6
Subprograms and Program Section Repeats
TNC 360
6-2
Fig. 6.1:
Flow diagram for a subprogram;
S
= jump,
R
= return jump
R
S
.
.
.
.
.
.
.
.
.
.
.
.
.
.
1
2
3
N1
% ... *
L1, 0 *
Z + 100 M2 *
G98 L1 *
G98 L0 *
N9999
% ... *
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 wish.
Labels
Subprograms and program section repeats are marked by labels.
A label carries a number from 0 to 254. Each label number (except 0) can
only appear once in a program. Labels are assigned with the command
G98.
LABEL 0 marks the end of a subprogram.
6.1 Subprograms
Principle
The (main) program is executed up to the block in
which the subprogram is called with Ln,0 (
1
).
Then the subprogram is executed from beginning to
end (G98 L0) (
2
).
Finally, the main program is resumed from the
block after the subprogram call (
3
).
Operating limits
• One 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 located at the end of the
main program (after the block with M2 or M30).
• If subprograms are located in the program before
the block with M02 or M30, they will be execut-
ed at least once even without being called.