M97 LOCAL SUB-ROUTINE CALL
This code is used to call a sub-routine, referenced by a line number N within the same program. A Pnnnnn code is required and must match the N line number. This is used for simple sub-routines within a program and does not require the complication of having a separate program. A local sub-routine must still end with an M99. If there is an L count on the M97 line, the sub-routine will be repeated that number of times.
Main program:
O04321 (Start of main program)
...
... (Part program)
...
M97 P123 (Jumps to line N123, after the M30, to execute a local sub-routine.)
... (The M99 at the end of the sub-routine will cause it to jump back here.)
...
... (Finish part program)
...
M30 (End of main program)
N123 (Identifies the start of the Local Sub-Routine called up by M97 P123)
...
... (Local sub-routine portion of part)
...
M99 (Jumps back to the line after the local sub-routine call in the main program)
|