CNC Machinist Calculator Ultra

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

AddressWhat it does
PN line number where the local subprogram starts
LNumber 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)

Example is in inch. Check offsets and clearances first.

Watch out for

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

AddressWhat it does
PN line number where the subprogram starts
LRepeat 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)
…

The full 6-line example is in the app. Example is in inch. Check offsets and clearances first.

Watch out for

Related codes

M98 · M99

M97 on other controls

The same number can mean something different on another control.

ControlMeaning
FanucInterrupt type macro disable
DMG Mori MAPPS (Fanuc)Macro interrupt mode cancel
Mazak (EIA)User macro interruption, invalid
Mitsubishi M70 M80Macro interrupt disable
Heidenhain TNC (ISO)Machine small contour steps
FadalIntersectional 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

App Store Google Play