Home › M-codes › Mach3 Mach4 › M99
M99 Subprogram return
Mach3 Mach4 M-code · Mill
Returns from a subprogram to the block after the M98. In a main program it rewinds and runs again.
Format
M99 [P]
Addresses
| Address | What it does |
|---|---|
P | Mach4, sequence number to return to in the main program |
How it works
Non modal.
Example program
O1000 (SUB PROGRAM)
G1 Z-0.5 F30.0 (FEED DOWN)
G12 I0.25 F20.0 (CUT CIRCLE)
G0 Z1.0 (RETRACT)
…
G1 Z-0.5 F30.0 (FEED DOWN)
G12 I0.25 F20.0 (CUT CIRCLE)
G0 Z1.0 (RETRACT)
…
The full 5-line example is in the app. Example is in inch. Check offsets and clearances first.
Watch out for
- M99 at the end of a main program loops forever. Mach3 M47 does the same.
Related codes
M99 on other controls
The same number can mean something different on another control.
| Control | Meaning |
|---|---|
| Fanuc | Subprogram end and return |
| Haas NGC | Subprogram return or loop |
| Doosan (Fanuc) | End of sub program |
| DMG Mori MAPPS (Fanuc) | Sub-program end Repeat program |
| Mazak (EIA) | EIA → EIA Return to main EIA program |
| Okuma OSP | Subprogram return (Lathes & Mills) |
| Mitsubishi M70 M80 | Subprogram end and return |
| Brother Speedio | Subprogram end |
| Heidenhain TNC (ISO) | Cycle call in a positioning block |
| LinuxCNC Tormach | Fanuc style subprogram return |
| Centroid CNC12 Acorn | Return from subprogram or macro |
| Hurco WinMax (NC) | Subprogram return |
| Fadal | End of subprogram, or line jump |
| Swiss (Citizen Star) | Subprogram return or program loop |
Every M-code for Mach3 Mach4 in your pocket. The app has the full example programs, search by number or shop word, a line decoder and calculators for tapping, threading and drilling.
Open M99 in the app All Mach3 Mach4 M-codes