Rockwell Automation 8520 9/Series CNC Lathe User Manual

Page 280

Advertising
background image

Introduction to Programming

Chapter 10

10-12

Generally, programs are executed sequentially. When you enter an
M98Pnnnnn command (“nnnnn” representing a subprogram number) in a

program, the control merges the subprogram (designated by the address P)

before the block that immediately follows the M98 command. The control

issues the error message “CANNOT OPEN SUBPROGRAM”, if it cannot

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. The letter O is omitted.

You might want 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 you enter an L command in a M98 command,

the control merges the subprogram (designated by the address P) before the

block that immediately follows the M98 command as many times as

designated by the L-word. 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 cannot 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, execution stops. The program resets or rewinds if

an M30 code is executed, or the program ends if the M02 code is executed.

10.3.1

Subprogram Call (M98)

Advertising