Back to GSM Code List

M97: Local subprogram / part counter

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.

Family
Subprograms
Machine
Milling, Turning, Mill-turn
Risk
Medium
Example
M97 P100
E.g.:
M97 P100

Parameters

P
Número de bloque N del subprograma local (Haas); en otros controles, contador o función según manual.
L
Repeticiones.

Machine: Milling, Turning, Mill-turnRisk: Medium

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.

Other codes in Subprograms

See the full list of G and M codes

Frequently 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 / part counter", 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 tools