Home › M-codes › Haas NGC › M99
M99 Subprogram return or loop
Haas NGC M-code · Mill, Lathe
On mills: Subprogram return or loop
Ends a subprogram and returns to the line after the call. In a main program M99 jumps back to the top to loop forever.
Format
M99 [P]
Addresses
| Address | What it does |
|---|---|
P | Line number to return to in the calling program |
How it works
Not modal. Acts once on the line where it is commanded.
Example program
O01012 (SUBPROGRAM)
G91 G01 Z-.1 F10. (STEP DOWN)
G90 (ABSOLUTE)
M99 (RETURN TO MAIN PROGRAM)
G91 G01 Z-.1 F10. (STEP DOWN)
G90 (ABSOLUTE)
M99 (RETURN TO MAIN PROGRAM)
Example is in inch. Check offsets and clearances first.
Watch out for
- M99 in a main program runs without end. Use it only for bar fed or warm up loops.
- Setting 118 controls whether M99 counts parts.
On lathes: Subprogram return or loop
Ends a subprogram and returns to the caller. With P it jumps to that N line. In a main program it loops back to the start until RESET.
Format
M99 [P]
Addresses
| Address | What it does |
|---|---|
P | N line to jump to |
How it works
Non-modal.
Example program
G105 (PUSH BAR)
M97 P100 (MACHINE THE PART)
M99 (LOOP TO START FOR NEXT PART)
M97 P100 (MACHINE THE PART)
M99 (LOOP TO START FOR NEXT PART)
Example is in inch. Check offsets and clearances first.
Watch out for
- M99 at the end of a main program runs forever on a bar feeder. Use a part counter or M30 to stop.
- Haas M99 P behaves a little differently from FANUC. Check the manual note when porting programs.
Related codes
M99 on other controls
The same number can mean something different on another control.
| Control | Meaning |
|---|---|
| Fanuc | Subprogram end and return |
| 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 |
| Mach3 Mach4 | 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 Haas NGC 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 Haas NGC M-codes