M-code reference
M99 M-Code: Subprogram Return / Loop
Subprogram Return / Loop — At the end of a subprogram it returns to the calling program. At the end of a main program it jumps back to the start — used for bar-feeder loops and warm-up…
| Property | Value |
|---|---|
| Code | M99 |
| Function | Subprogram Return / Loop |
| Used on | Mills and lathes |
What does M99 do?
At the end of a subprogram it returns to the calling program. At the end of a main program it jumps back to the start — used for bar-feeder loops and warm-up programs.
M99 example
O1001
G91 G01 Z-2.0 F150.
G90 X50.0
M99Tips
- M99 Pn returns to block Nn in the main program.
- An M99 in a main program loops forever — stop with M30 or a counter.
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 |
M98 | Subprogram Call |
Frequently asked questions
What does M99 mean on a CNC machine?
M99 is Subprogram Return / Loop. At the end of a subprogram it returns to the calling program. At the end of a main program it jumps back to the start — used for bar-feeder loops and warm-up programs.