2 main and subprogram return (m99) – Rockwell Automation 8520 9/Series CNC Lathe User Manual

Page 281

Advertising
background image

Introduction to Programming

Chapter 10

10-13

M99 code acts as a return command in both sub- and main programs;
however, there are specific differences:

Using M99 in a Main Program

If you use M99

in a:

M99:

Main program

executes all commands in the block, regardless if information

is programmed in the block to the right of the M99 command
clears all modal codes similar to an M02 or M30 (simulates

start-up conditions)
resets the current main program to the first block
automatically performs a cycle start on the program after it is

reset and program execution starts over.

Subprogram

tells the control the end of a subprogram
will not merge any commands within a file that is used as a

subprogram and follows a M99 code in the main program into

the calling program.

Using M99 in a Subprogram

Program the M99 code anywhere in a program block, provided no axis

words are programmed to the left of M99. Any information (other than

axis words) programmed to the left of M99 is executed as part of the

subprogram, while information (including axis words) programmed in the

block to the right of the M99 command is ignored.

If you program:

Then:

M99X10;

X10 is ignored in this subprogram block

X10M99;

X10 generates an error in this subprogram

M03M99;

M03 is executed as normal in this subprogram

10.3.2

Main and Subprogram

Return (M99)

Advertising