Rockwell Automation 8520-MUM 9/Series CNC Mill Operation and Programming Manual Documentation Set User Manual
Page 288
Introduction to Programming
Chapter 10
10-14
M99 code acts as a return command in both sub- and main programs.
There are specific differences, however, when the code is used in a sub
program and when it is used in a main program.
Using M99 in a Main Program
When used in a main program, M99 does the following:
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.
Using M99 in a Subprogram
When used in a subprogram, M99 does the following:
tells the control the end of a subprogram
does not merge any commands within a subprogram that follow the
M99 code into the main program
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.
Important: If you want to merge a file the into the calling program, it is
not necessary to program a M99 code in the subprogram unless it is in a
block immediately before the end of program command (M02 or M30) in
the subprogram.
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)