Home › M-codes › Haas NGC › M97
M97 Local subprogram call
Haas NGC M-code · Mill, Lathe
On mills: Local subprogram call
Calls a subprogram that is in the same program at line number P. L repeats it.
Format
M97 P [L]
Addresses
| Address | What it does |
|---|---|
P | N line number where the local subprogram starts |
L | Number of times to repeat |
How it works
Not modal. Acts once on the line where it is commanded.
Example program
M97 P1000 L2 (RUN LOCAL SUB AT N1000 TWO TIMES)
M30 (END OF MAIN PROGRAM)
N1000 G91 G01 Z-.1 F10. (STEP DOWN)
G90 M99 (RETURN)
M30 (END OF MAIN PROGRAM)
N1000 G91 G01 Z-.1 F10. (STEP DOWN)
G90 M99 (RETURN)
Example is in inch. Check offsets and clearances first.
Watch out for
- The local subprogram should be after M30 and end with M99.
- P is an N line number, not a program number.
On lathes: Local subprogram call
Calls a subprogram that starts at line N in the same program. L repeats it. The subprogram ends with M99.
Format
M97 P [L]
Addresses
| Address | What it does |
|---|---|
P | N line number where the subprogram starts |
L | Repeat count |
How it works
Non-modal.
Example program
M97 P1000 L2 (RUN N1000 TWICE)
M30 (END MAIN PROGRAM)
N1000 G00 X1.1 Z-.5 (LOCAL SUB START)
G01 X.9 F.003 (GROOVE)
…
M30 (END MAIN PROGRAM)
N1000 G00 X1.1 Z-.5 (LOCAL SUB START)
G01 X.9 F.003 (GROOVE)
…
The full 6-line example is in the app. Example is in inch. Check offsets and clearances first.
Watch out for
- Put the local subprogram after M30 so it does not run by itself.
- P values are modal in canned cycles. Do not call M97 with a cycle active.
Related codes
M97 on other controls
The same number can mean something different on another control.
| Control | Meaning |
|---|---|
| Fanuc | Interrupt type macro disable |
| DMG Mori MAPPS (Fanuc) | Macro interrupt mode cancel |
| Mazak (EIA) | User macro interruption, invalid |
| Mitsubishi M70 M80 | Macro interrupt disable |
| Heidenhain TNC (ISO) | Machine small contour steps |
| Fadal | Intersectional cutter comp |
Every M-code for Haas NGC in your pocket. The app has the full example programs, search by number or shop word, a line decoder and calculators for tapping, threading and drilling.
Open M97 in the app All Haas NGC M-codes