3 subprogram nesting – Rockwell Automation 8520-MUM 9/Series CNC Mill Operation and Programming Manual Documentation Set User Manual
Page 290

Introduction to Programming
Chapter 10
10-16
Nesting is the term used to describe one program calling another. The
program called is said to be a nested program. When a subprogram is
called from the main program it is said to be on the first nesting level or
nesting level 1. If that subprogram in turn calls another subprogram the
called subprogram is said to be in nesting level 2. Subprograms may be
nested up to a maximum of 4 levels.
Figure 10.3
Subprogram Nesting
Main
program
Sub-
program 1
Sub-
program 2
Sub-
program 3
Sub-
program 4
Level 1
Level 2
Level 3
Level 4
M02;p
M99;
M99;
M99;
M99;
M98P11111;
M98P22222;
M98P33333;
M98P44444;
0 00001;
0 11111;
0 22222;
0 33333;
0 44444;
Important: Calling a macro (see chapter 28) does not add to the nesting
level of any active subprograms. Up to four subprograms may still be
nested though the combined total of nested macros and subprograms may
not exceed 8.
10.3.3
Subprogram Nesting