Manual

Introduction to Programming
Chapter 10
1
0
-
1
3
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 commandsin theblock, regardless if information
is programmedin theblock tothe right of theM99 command
clears allmodal codessimilar to anM02 or M30 (simulates
start-up conditions)
resets thecurrent main programto thefirst block
automatically performsa cyclestart on theprogram after it is
reset and program execution startsover.
Subprogram tells the controlthe end of a subprogram
will not mergeany commandswithin afile that isused asa
subprogram andfollows a M99 codein themain 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 inthis subprogramblock
X10M99; X10 generates an errorin thissubprogram
M03M99; M03 isexecuted asnormal inthis subprogram
10.3.2
Main and Subprogram
Return (M99)