M97: Local subprogram call (Haas)
You can call local subprogram or count pieces according to control/manufacturer.
For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.
The brands and control names mentioned belong to their owners and are used only to identify the equipment. GetGCode is not affiliated with or endorsed by any manufacturer, ISO or ASME: this is our own content, not official documentation. Legal notice.
- Family
- Subprograms
- Machine
- Milling, Turning, Mill-turn
- Risk
- Medium
- Example
- M97 P100
How to write it on each control
| Example | M97 P100 | |
|---|---|---|
| Haas | M97 P... | In Haas it usually calls a local subroutine by line number. |
| Fanuc | — | On some lathes it may be assigned to a piece counter or another PLC function. |
Parameters
- P
- N block number of the local subprogram (Haas); on other controls, a counter or function per the manual.
- L
- Repeats.
Machine: Milling, Turning, Mill-turn
Sources
- Official manual: Haas Mill Operator's Manual, Next Generation Control (96-8210 Rev T, 2023) · M97
- Official manual: Haas Lathe Operator's Manual, Next Generation Control (96-8910 Rev R, 2022) · M97
- Official manual: FANUC Series 16i/18i/21i-MB Operator's Manual (B-63534EN/02) · M97
- Official manual: GE Fanuc Series 16i/18i/160i/180i-TB Operator's Manual (GFZ-63524EN/01) · M97
Other codes in Subprograms
See the full list of G and M codesFrequently Asked Questions (FAQ)
What does M97 mean in a CNC program?
You can call local subprogram or count pieces according to control/manufacturer. In the catalogue it appears as "Local subprogram call (Haas)", within the Subprograms family.
How is M97 written on each control?
Haas: M97 P.... The exact syntax depends on the control version and the machine parameters: always confirm with the manufacturer's manual.
Can you give me an example of M97?
M97 P100 — You can call local subprogram or count pieces according to control/manufacturer.
Which machines use M97?
M97 is used in: Milling, Turning, Mill-turn.
What should you watch out for with M97?
Medium risk: it rarely breaks anything on its own, but a wrong value shows up on the part. Check the block before running the batch.
Related apps
CNC G-code Simulator
CNC IDE: editing with G/M tooltips, line inspector, conversion between controls and 2D/3D toolpath.
CNC Alarms Guide
CNC Alarms and Solutions Guide. Enter the error code or symptom to find the cause and how to repair it at the machine.
Calculate cycle time
Estimate CNC turning and milling cycle time from G-code. Calculate parts per hour with a breakdown of cutting, rapids, canned cycles and tool changes.