Nesting with LBL
Application
You can combine program section repeats and subprograms with each other and also with other programming techniques, such as calling a separate NC program.
If you want to return to the origin after each call, use only one nesting level. If you program another call before returning to the origin, you will get one nesting level lower.
Related topics
- Subprograms
- Program section repeats
- Calling a separate NC program
Description of function
Please note the maximum nesting depth:
- Maximum nesting depth for subprogram calls: 19
- Maximum nesting depth for calls of external NC programs: 19 where a CYCL CALL has the same effect as calling an external program
- Program-section repeats can be nested as often as desired
Example
Subprogram call within a subprogram
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
0 BEGIN PGM UPGMS MM | |
* - ... | |
11 CALL LBL “UP1“ | ; Call subprogram "UP1" |
* - ... | |
21 L Z+100 R0 FMAX M30 | ; Last program block of main program with M30 |
22 LBL “UP1“ | ; Start of subprogram "UP1" |
* - ... | |
31 CALL LBL 2 | ; Call subprogram 2 |
* - ... | |
41 LBL 0 | ; End of subprogram "UP1" |
42 LBL 2 | ; Start of subprogram 2 |
* - ... | |
51 LBL 0 | ; End of subprogram 2 |
52 END PGM UPGMS MM |
The control executes the NC program as follows:
- NC program UPGMS is executed up to NC block 11.
- Subprogram UP1 is called and executed up to NC block 31.
- Subprogram 2 is called, and executed up to NC block 51. End of subprogram 2 and return jump to the subprogram from which it was called.
- Subprogram UP1 is executed from NC block 32 up to NC block 41. End of subprogram UP1 and return jump to NC program UPGMS.
- NC program UPGMS is executed from NC block 12 up to NC block 21. Program end with return jump to NC block 0.
Program-section repeat within a program section repeat
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
0 BEGIN PGM REPS MM | |
* - ... | |
11 LBL 1 | ; Start of program section 1 |
* - ... | |
21 LBL 2 | ; Start of program section 2 |
* - ... | |
31 CALL LBL 2 REP 2 | ; Call program section 2 and repeat twice |
* - ... | |
41 CALL LBL 1 REP 1 | ; Call program section 1 including program section 2 and repeat once |
* - ... | |
51 END PGM REPS MM |
The control executes the NC program as follows:
- NC program REPS is executed up to NC block 31.
- The program section between NC block 31 and NC block 21 is repeated twice, meaning that it is executed three times in total.
- NC program REPS is executed from NC block 32 up to NC block 41.
- The program section between NC block 41 and NC block 11 is repeated once, meaning that it is executed twice in total (including the program section repeat between NC block 21 and NC block 31).
- NC program REPS is executed from NC block 42 up to NC block 51. Program end with return jump to NC block 0.
Subprogram call within a program section repeat
NC programs contained in this User's Manual are suggestions for solutions. The NC programs or individual NC blocks must be adapted before being used on a machine.
Change the following contents as needed:
- Tools
- Cutting parameters
- Feed rates
- Clearance height or safe position
- Machine-specific positions (e.g., with M91)
- Paths of program calls
Some NC programs depend on the machine kinematics. Adapt these NC programs to your machine kinematics before the first test run.
In addition, test the NC programs using the simulation before the actual program run.
With a program test you determine whether the NC program can be used with the available software options, the active machine kinematics and the current machine configuration.
0 BEGIN PGM UPGREP MM | |
* - ... | |
11 LBL 1 | ; Start of program section 1 |
12 CALL LBL 2 | ; Call subprogram 2 |
13 CALL LBL 1 REP 2 | ; Call program section 1 and repeat twice |
* - ... | |
21 L Z+100 R0 FMAX M30 | ; Last NC block of main program with M30 |
22 LBL 2 | ; Start of subprogram 2 |
* - ... | |
31 LBL 0 | ; End of subprogram 2 |
32 END PGM UPGREP MM |
The control executes the NC program as follows:
- NC program UPGREP is executed up to NC block 12.
- Subprogram 2 is called, and executed up to NC block 31.
- The program section between NC block 13 and NC block 11 (including subprogram 2) is repeated twice, meaning that it is executed three times in total.
- NC program UPGREP is executed from NC block 14 up to NC block 21. Program end with return jump to NC block 0.