1 subprogram call (m98) – Rockwell Automation 8520-MUM 9/Series CNC Mill Operation and Programming Manual Documentation Set User Manual

Page 287

Advertising
background image

Introduction to Programming

Chapter 10

10-13

Generally, programs are executed sequentially. When an M98Pnnnnn
(“nnnnn” representing a subprogram number) command is entered in a
program, the control will merge the subprogram, designated by the address
P, before the block that immediately follows the M98 command. Note that
the control will issue the error message “CANNOT OPEN
SUBPROGRAM” if it can not find the subprogram designated by the M98
command.

For example,

M98 P00001 ;

would cause execution to transfer from the current program to the
subprogram numbered 00001.

Important: For a program to be used as a subprogram it must have a
program name starting with the letter O followed by up to a 5 digit
numeric value. When calling the subprogram with a P--word only the
numeric value is used, and the letter O is omitted.

Sometimes it is desirable to execute a subprogram more than one time.
For example,

M98PnnnnnLmm;

would cause the subprogram numbered nnnnn to be merged in the main
program mm times. When an L command is entered in a M98 command,
the control will merge the subprogram, designated by the address P, before
the block that immediately follows the M98 command the number of times
designated by the L--word. Note that both the P-- and L--words must
follow the M98 command in a program block.

Omission of an L--word is regarded as L1. An L--word can not be a
negative value or have a value of zero.

Important: If M02 or M30 codes are found in a subprogram before the
program reads an M99 they will stop program execution. The program
will reset or rewind if an M30 code is executed or the program will end if
the M02 code is executed.

10.3.1
Subprogram Call (M98)

Advertising