M-code reference

M97 M-Code: Local Subprogram Call (Haas)

Local Subprogram Call (Haas) — Haas: calls a subprogram located inside the same program by its N number. M99 returns. L sets repeats.

By cnccode · Updated
PropertyValue
CodeM97
FunctionLocal Subprogram Call (Haas)
Used onMills and lathes

What does M97 do?

Haas: calls a subprogram located inside the same program by its N number. M99 returns. L sets repeats.

M97 example

Example
M97 P1000 L3
M30
N1000 (subroutine)
G91 G01 Z-1.0 F200.
G90
M99

Tips

  • Fanuc does not support M97; use M98 with a separate O number.

M-codes vary between machine builders. Codes from M00 to M09, M30 and M98/M99 are nearly universal; most others are defined by the machine builder. Always check the M-code list in your machine manual.

Most-used M-codes

CodeFunction
M00Program Stop
M01Optional Stop
M03Spindle On Clockwise
M04Spindle On Counter-Clockwise
M05Spindle Stop
M06Tool Change
M08Flood Coolant On
M09Coolant Off
M30Program End and Rewind
M98Subprogram Call
M99Subprogram Return / Loop

Frequently asked questions

What does M97 mean on a CNC machine?
M97 is Local Subprogram Call (Haas). Haas: calls a subprogram located inside the same program by its N number. M99 returns. L sets repeats.