Haas M99 Subprogram Return or Loop

As Haas subprogram commands M97 M98 are already briefly described with subprogram examples, read here

Haas M97 Local Subprogram Call with CNC Program Example

Haas M98 Subprogram Call with Basic Example Code

Some more CNC Subprograms related articles

CNC Subprograms Basics for CNC Machinists

Fanuc Sub Programs described here

Fanuc Sub Programming

Fanuc Subprogram Example

Multi Start Threads with Fanuc G76 Threading Cycle

Haas M99 Subprogram Return

Haas M99 is used to return to the main program from a subroutine (subprogram) or macro.

Haas CNC

Haas CNC

Haas M98 Subprogram Call M99 Subprogram Return Example

O0001 (Main Program number)
M98 P100 L4; (Call sub-program O0100 – repeat subprogram 4 times)
M30 (End of program)
O0100 (Sub-program Number)
G00 G90 G55 X0 Z0 (N line that will run after M98 P100 is run)
S500 M03
G00 Z-.5
G01 X.5 F100.
G03 Z...
G01 X0
Z1. F50.
G91 G28 Z0
G90
M99 (sub-program end, return to main-program)

Haas M97 CNC Local Subprogram Call M99 Subprogram Return Example

O0001
M97 P1000 L2 (L2 command will run the N1000 line twice)
M30
N1000 G00 G90 G55 X0 Z0 (N line that will run after M97 P1000 is run)
S500 M03
G00 Z-.5
G01 X.5 F100.
G03 Z...
G01 X0
Z1. F50.
G91 G28 X0
G28 Z0
G90
M99

Haas M99 Loop

M99 can also be written at the end of a main program, and would result in a continuous program loop.

Haas M99 Main Program Loop Example

O0001
S500 M03
G00 Z-.5
G01 ...
G03 ...
G01 X0
Z1. F50.
G91 G28 X0
G28 Z0
G90
M99