M-code reference
M98 M-Code: Subprogram Call
Subprogram Call — Calls a separate subprogram (O number) and runs it the given number of times. It is used for repeated features, multiple parts and pattern work.
| Property | Value |
|---|---|
| Code | M98 |
| Function | Subprogram Call |
| Used on | Mills and lathes |
What does M98 do?
Calls a separate subprogram (O number) and runs it the given number of times. It is used for repeated features, multiple parts and pattern work.
M98 example
M98 P1001 L4 (run O1001 4 times)
(Fanuc 0i alt format: M98 P41001)Tips
- Use G91 inside the subprogram for incremental stepping (e.g. depth passes).
- "Program not found" alarms mean the O number is missing from memory.
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.
Related codes
Most-used M-codes
| Code | Function |
|---|---|
M00 | Program Stop |
M01 | Optional Stop |
M03 | Spindle On Clockwise |
M04 | Spindle On Counter-Clockwise |
M05 | Spindle Stop |
M06 | Tool Change |
M08 | Flood Coolant On |
M09 | Coolant Off |
M30 | Program End and Rewind |
M99 | Subprogram Return / Loop |
Frequently asked questions
What does M98 mean on a CNC machine?
M98 is Subprogram Call. Calls a separate subprogram (O number) and runs it the given number of times. It is used for repeated features, multiple parts and pattern work.