
12.PROGRAM CONFIGURATION NC FUNCTIONS B-63782EN/01
- 138 -
12.4 SUB PROGRAM
When there are fixed sequences or frequently repeated patterns in a
program, programming can be simplified by entering these pattern as
sub programs to the memory. Sub program is called by M98, and M99
commands return from the sub program. The sub program can be
nested 10 folds.
Format
- Subprogram configuration
One subprogram
Subprogram number
Program end
M99 need not constitute a separate block as indicated
below.
Example) X100.0Y100.0M99;
- Subprogram call
M98 P_ L_ ;
P : program-number
L : number of repeats
Address L is used to specify the number of times the
subprogram is repeated.
O1234;
:
:
M99;
O1000;
.
.
.
M98 P2000;
.
.
.
M30;
O5677;
.
.
.
M98 P5678;
.
.
.
M99;
O3000;
.
.
.
M98 P4000;
.
.
.
M99;
O2000;
.
.
.
M98 P3000;
.
.
.
M99;
O5678;
.
.
.
.
.
.
.
M99;
(One-level nesting) (Two-level nesting) (Nine-level nesting) (Ten-level nesting)
Main program Subprogram Subprogram Subprogram Subprogram