Haas CNC M97 Local Sub-Program Call with CNC Program Example

Almost every cnc controls has a way to make subprograms, subroutines.

CNC Subprograms are added to cnc program memory (cnc program directory) as separate cnc programs which are then called from an outside cnc program (main-program).

Read more about CNC Subprograms

Haas CNC

Haas CNC

Haas CNC Local SubPrograms

Haas CNC supports normal cnc sub-programming commands M98, M99.
But Haas CNC gives a lot more and manageable way to make subprograms (subroutines), called Local Sub-Programs.
Haas cnc local subprograms are not added as separate cnc programs to cnc programs memory.
But Haas cnc local subprograms are added (at end) to the main-program or calling program.
So Haas cnc local subprograms are part of the main-program.

How to Call Haas CNC Local SubProgram

Haas cnc local subprograms are called with M97 command.
Haas CNC Local Subprogram Call M97 Format
M97 P… L…
P – A line number within same program (Subprogram must end with M99).
L – Number of subprogram repetitions.

Haas CNC Local Subprogram 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