
PROGRAMMING
13. PROGRAM CONFIGURATION
B–63124EN/01
134
See Chapter 10 in Part III for the method of registering a subprogram.
NOTE
1 The M98 and M99 signals are not output to the machine
tool.
2 If the subprogram number specified by address P cannot
be found, an alarm (No. 078) is output.
l M98 P51002 ;
l X1000.0 M98 P1200 ;
l Execution sequence of subprograms called from a main program
A subprogram can call another subprogram in the same way as a main pro-
gram calls a subprogram.
This command specifies ”Call the subprogram (number 1002) five times in
succession.” A subprogram call command (M98P_) can be specified in the
same block as a move command.
This example calls the subprogram (number 1200) after an X movement.
1
2
3
Main program
N0010
0 ;
N0020
0 ;
N0030 M98 P21010 ;
N0040
0 ;
N0050 M98 P1010 ;
N0060
0 ;
Subprogram
O1010
0 ;
N1020
0 ;
N1030
0 ;
N1040
0 ;
N1050
0 ;
N1060
0 M99 ;
If P is used to specify a sequence number when a subprogram is
terminated, control does not return to the block after the calling block, but
returns to the block with the sequence number specified by P. Note,
however, that P is ignored if the main program is operating in a mode other
than memory operation mode.
This method consumes a much longer time than the normal return method
to return to the main program.
Subprogram
O0010
… ;
N1020
… ;
N1030
… ;
N1040
… ;
N1050
… ;
N1060 M99 P0060 ;
Main program
N0010
… ;
N0020
… ;
N0030 M98 P1010 ;
N0040
… ;
N0050
… ;
N0060
… ;
D Reference
Examples
Special Usage
D Specifying the sequence
number for the return
destination in the main
program