Subprograms and program section repeats | Nesting
Repeating a subprogram
Example
0 BEGIN PGM UPGREP MM
...
10 LBL 1
Beginning of program section repeat 1
11 CALL LBL 2
Subprogram call
12 CALL LBL 1 REP 2
Program section call with two repeats
...
19 L Z+100 R0 FMAX M2
Last NCblock of the main program with M2
20 LBL 2
Beginning of subprogram
...
28 LBL 0
End of subprogram
29 END PGM UPGREP MM
Program execution
1 Main program UPGREP is executed up to NCblock11
2 Subprogram 2 is called and executed.
3 The program section between NCblock12 and NCblock10 is
repeated twice. This means that subprogram 2 is repeated twice
4 Main program UPGREP is executed from NCblock13 up to
NCblock19. Return jump to NCblock1 and end of program
8
HEIDENHAIN | TNC620 | Klartext Programming User's Manual | 01/2022
261