beautypg.com

Subprogram within a subprogram – HEIDENHAIN TNC 320 (34055x-06) User Manual

Page 228

background image

Programming: Subprograms and program section repeats

7.5

Nesting

7

228

TNC 320 | User's Manual HEIDENHAIN Conversational Programming | 5/2013

Subprogram within a subprogram

Example NC blocks

0 BEGIN PGM UPGMS MM
...
17 CALL LBL "UP1"

Call the subprogram marked with LBL SP1

...
35 L Z+100 R0 FMAX M2

Last program block of the main program (with M2)

36 LBL "UP1"

Beginning of subprogram SP1

...
39 CALL LBL 2

Call the subprogram marked with LBL 2

...
45 LBL 0

End of subprogram 1

46 LBL 2

Beginning of subprogram 2

...
62 LBL 0

End of subprogram 2

63 END PGM UPGMS MM

Program execution

1 Main program UPGMS is executed up to block 17.

2 Subprogram SP1 is called, and executed up to block 39.

3 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.

4 Subprogram 1 is called, and executed from block 40 up to block

45. End of subprogram 1 and return jump to the main program
UPGMS.

5 Main program UPGMS is executed from block 18 up to block 35.

Return jump to block 1 and end of program.