CNC Machinist Calculator Ultra

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

AddressWhat it does
PLine 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)

Example is in inch. Check offsets and clearances first.

Watch out for

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

AddressWhat it does
PN 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)

Example is in inch. Check offsets and clearances first.

Watch out for

Related codes

M97 · M98 · M30

M99 on other controls

The same number can mean something different on another control.

ControlMeaning
FanucSubprogram 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 OSPSubprogram return (Lathes & Mills)
Mitsubishi M70 M80Subprogram end and return
Brother SpeedioSubprogram end
Heidenhain TNC (ISO)Cycle call in a positioning block
LinuxCNC TormachFanuc style subprogram return
Mach3 Mach4Subprogram return
Centroid CNC12 AcornReturn from subprogram or macro
Hurco WinMax (NC)Subprogram return
FadalEnd 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

App Store Google Play