External Subprogram (M98)

Next Generation Control Mill Operator's Manual

The Online Interactive Operator's Manual is currently available in English only.

A PDF version of the Operator's Manual is available for download in multiple languages. Click the link below to view the Operator's Manual in your language. Click "Continue" to view the online version in English.

Get a translated PDF Download Continue

An external subprogram is a separate program that the main program references. Use M98 to command (call) an external subprograms, with Pnnnnn to refer to the program number you want to call.

When your program calls an M98 subprogram, the control looks for the subprogram in the main program’s directory. If the control cannot find the subprogram in the main program’s directory, it then looks in the location specified in Setting 251. Refer to Setting 251 for more information. An alarm occurs if the control cannot find the subprogram.

In this example, the subprogram (program O40008) specifies (8) positions. It also includes a G98 command at the move between positions 4 and 5. This causes the Z Axis to return to the initial starting point instead of the R plane, so the tool passes over the workholding.

The main program (Program O40007) specifies (3) different canned cycles:

  1. G81 Spot drill at each position
  2. G83 Peck drill at each position
  3. G84 Tap at each position

Each canned cycle calls the subprogram and does the operation at each position.

% O40007 (External subprogram ex-prog) ;
(G54 X0 Y0 is center left of part) ;
(Z0 is on top of the part) ;
(T1 is a spot drill) ; (T2 is a drill) ;
(T3 is a tap) ;
(BEGIN PREPARATION BLOCKS) ;
T1 M06 (Select tool 1) ;
G00 G90 G40 G49 G54 (Safe startup) ;
G00 G54 X1.5 Y-0.5 (Rapid to 1st position) ;
S1000 M03 (Spindle on CW) ;
G43 H01 Z1. (Tool offset 1 on) ;
M08 (Coolant on) ;
(BEGIN CUTTING BLOCKS) ;
G81 G99 Z-0.14 R0.1 F7. (Begin G81) ;
M98 P40008 (Call external subprogram) ;
(BEGIN COMPLETION BLOCKS) ;
G00 Z1. M09 (Rapid retract, Coolant off) ;
G53 G49 Z0 M05 (Z home, Spindle off) ;
M01 (Optional stop) ;
(BEGIN PREPARATION BLOCKS) ;
T2 M06 (Select tool 2) ;
G00 G90 G40 G49 G54 (Safe startup) ;
G00 G54 X1.5 Y-0.5 (Rapid to 1st position) ;
S2082 M03 (Spindle on CW) ;
G43 H02 Z1. (Tool offset 1 on) ;
M08 (Coolant on) ;
(BEGIN CUTTING BLOCKS) ;
G83 G99 Z-0.75 Q0.2 R0.1 F12.5 (Begin G83) ;
M98 P40008 (Call external subprogram) ;
(BEGIN COMPLETION BLOCKS) ;
G00 Z1. M09 (Rapid retract, Coolant off) ;
G53 G49 Z0 M05 (Z home, Spindle off) ;
M01 (Optional stop) ;
(BEGIN PREPARATION BLOCKS) ;
T3 M06 (Select tool 3) ;
G00 G90 G40 G49 G54 (Safe startup) ;
G00 G54 X1.5 Y-0.5 (Rapid to 1st position) ;
S750 M03 (Spindle on CW) ;
G43 H03 Z1. (Tool offset 3 on) ;
M08 (Coolant on) ;
(BEGIN CUTTING BLOCKS) ;
G84 G99 Z-0.6 R0.1 F37.5 (Begin G84) ;
M98 P40008 (Call external subprogram);
(BEGIN COMPLETION BLOCKS) ;
G00 Z1. M09 (Rapid retract, Coolant off) ;
G53 G49 Z0 M05 (Z home, Spindle off) ;
G53 Y0 (Y home) ;
M30 (End program) ;
%

Subprogram Pattern

Subprogram

% O40008 (Subprogram) ;
X0.5 Y-0.75 (2nd position) ;
Y-2.25 (3rd position) ;
G98 X1.5 Y-2.5 (4th position) ;
(Initial point return) ;
G99 X3.5 (5th position) ;
(R plane return) ;
X4.5 Y-2.25 (6th position);
Y-0.75 (7th position) ;
X3.5 Y-0.5 (8th position) ;
M99 (sub program return or loop) ;
%

Be aware: Many service and repair procedures should be done only by authorized personnel. The service technicians at your Haas Factory Outlet (HFO) have the training, experience, and are certified to do these tasks safely and correctly. You should not do machine repair or service procedures unless you are qualified and knowledgeable about the processes.

Danger: Some service procedures can be dangerous or life-threatening. DO NOT attempt a procedure that you do not completely understand. Contact your Haas Factory Outlet (HFO) and schedule a service technician visit if you have any doubts about doing a procedure.

Feedback