beautypg.com

HEIDENHAIN TNC 407 (280 580) User Manual User Manual

Page 186

background image

TNC 425/TNC 415 B/TNC 407

6-12

6

Subprograms and Program Section Repeats

6.4

Nesting

.
.
.

.
.
.

.
.
.

Repeating a subprogram

Program layout

0

BEGIN PGM SPGMREP MM

e.g. 10

LBL 1

11

CALL LBL 2 ............................................... Call the subprogram

12

CALL LBL 1 REP 2/2

..... Program section repetition

e.g. 19

L Z+100 R0 FMAX M2 .............................. Last program block of the main program with M2

20

LBL 2 ......................................................... Beginning of subprogram

e.g. 28

LBL 0 ......................................................... End of subprogram

29

END PGM SPGMREP MM ........................ End of main program

Program execution

1st Step:

Main program SPGMREP is executed up to block 11.

2nd Step:

Subprogram 2 is called and executed.

3rd Step:

Program section between block 12 and block 10 is repeated
twice. This means that subprogram 2 is repeated twice.

4th Step:

Main program SPGMREP is executed from block 13 to
block 19. End of program.

5

1

2

2x

3

4