beautypg.com

Nesting -9, Nesting depth -9 subprogram within a subprogram -9, 4 nesting – HEIDENHAIN TNC 407 (280 580) ISO Programming User Manual

Page 187

background image

6-9

TNC 426/TNC 425/TNC 415 B/TNC 407

6

Subprograms and Program Section Repeats

.
.
.

.
.
.

3

4

2

5

1

6.4 Nesting

Subprograms and program section repeats can be nested in the following
ways:

• Subprograms within a subprogram
• Program section repeats within a program section repeat
• Subprograms repeated
• Program section repeats within a subprogram

Nesting depth

The nesting depth is the number of successive levels in which program
sections or subprograms can call further program sections or subpro-
grams.

Maximum nesting depth for subprograms: 8

Maximum nesting depth for calling main programs: 4

Subprogram within a subprogram

Program layout

% UPGMS G71 *

e.g. N17

L1,0 * ....................................................... Call subprogram at G98 L1

e.g. N35

G00 G40 Z+100 M2 * .............................. Last block of main program (with M2)

N36

G98 L1 *

e.g. N39

L2,0 *

e.g. N45

G98 L0 * ................................................... End of subprogram 1

N46

G98 L2 *

e.g. N62

G98 L0 * ................................................... End of subprogram 2

N99999

% UPGMS G71 * ..................................... End of main program

Program execution

1st step:

The main program UPGMS is executed up to block 17.

2nd step:

Subprogram 1 is called, and executed up to block 39.

3rd step:

Subprogram 2 is called, and executed up to block 62.
End of subprogram 2 and return jump to the subprogram from which it was called.

4th step:

Subprogram 1 is called, and executed from block 40 to block 45.
End of subprogram 1 and return jump to the main program UPGMS.

5th step:

Main program UPGMS is executed from block 18 to block 35.
Return jump to block 1 and end of program.

.
.
.

.
.
.

.
.
.

Subprogram 1
with call of
subprogram 2

Subprogram 2