
12. PROGRAM CONFIGURATION
12.1 Main Program and Subprogram
(b) Subprogram execution
A subprogram is executed when called by the main program or another
subprogram.
A subprogram call has the following format:
M98P 000 0000
WV
Subprogram number
Number of times the subprogram is to be repeated.
When the repetition times is omitted, the subprogram is repeated once.
When the number of repetitions is specified, the subprogram number must have
four digits.
Example) M98P51002;
This command specifies “Call the subprogram (subprogram number 1002) five
times. “
The subprogram call command (M98P
) and a move command can
be specified in the same block.
Example) Xl 000 M98P 1200;
In this example, the subprogram (subprogram number 1200) is called after
completing movement in the X-axis direction.
Example)
The execution sequence of a- main program which calls a subprogram is as
follows:
Main program
2
Subprogram
NO010
NO020
N0030M98P21010
NO040
N1030
) } NlO40 ~~
;
N0050M98PlOlO
NO060
N1050
N1060
M99
When the subprogram is called by another subprogram, it is executed in the
same sequence as shown in the above example.
(Note 1) M98 and M99 signals are not issued to the machine tool.
(Note 2) If the subprogram number specified by address P can not be found, P/S alarm No. 78 is displayed.
(c) Notes on subprogram control
The following special specifications can be used to control subprogram
execution.
0
i
When a sequence number is specified in address P of the last block of a
subprogram, control does not return to the block after the block in which the
subprogram was called, but rather to the block with the sequence number
specified in address P. P is ignored when the main program is running in a
mode other than AUTO mode (for example, tape running mode).
The processing time for return to the specified block is considerably longer
than that for normal return.
l-40