
Originally Posted by
mactec54
M97 is a normal standard Code it's a different way the sub can be used and only some controls use it, here is an explanation of it and how to use it
"What is M-CODE M97, M98 & M99 (Sub Programs or Sub Routines) Mean in CNC Programming"
M-Code M97, M98 and M99 Sub programming M-Codes
M97 Local Sub-Program Call (P, L):
M97 is the M-code Used to call a Subprogram with the reference of the line number N within the same program. Pxxxx code is used as a line number to be repeated. Xxxx is the line number in the same program. This is used for the simple program within the program and does not require complication of creating a sub program. A local sub-program must end with an M99. If there is a repetition of the loop of subprogram L count on the M97 line, the sub-program will be repeated L number of times.
M97 Program Format:
M97 Pxxxx Lnn
Whereas, xxxx is the line number
nn is the number of repetitions
Example:
Main program:
O01234 (Program number and Start of main program)
N0001 T02 M06;
N0002 T03
N0003 G54 G90 G00 Z50
...
...
... (Part program)
...
M97 P0015 L3 (Jumps to line N0015, after the M30, to execute a local sub-program for 3 times)
... (The M99 at the end of the sub-program will cause it to jump back here.)
...
...
... (Finish part program)
...
M30 (End of main program)
N0015 (Identifies the start of the Local Sub-Program called up by M97 P0015)