Home › M-codes › Mach3 Mach4 › M98
M98 Subprogram call
Mach3 Mach4 M-code · Mill
Jumps to the block with the given O number, runs it and comes back at M99. Mach4 also looks in the Subroutines folder. Mach3 can also call a file by name.
Format
M98 P [Q] [L] or M98 (FILE NAME) [L]
Addresses
| Address | What it does |
|---|---|
P | O number of the subprogram |
L | Repeat count, default 1 |
Q | Mach4 start sequence number in the sub, Mach3 another repeat word |
(FILE NAME) | Mach3 only, a separate file in parentheses |
How it works
Non modal.
Example program
(MAIN PROGRAM)
G0 G20 G90 G54 G17 G40 G49 G80 (SAFE START, INCH)
T1 M6 (TOOL CHANGE)
S6000 M3 (SPINDLE ON)
…
G0 G20 G90 G54 G17 G40 G49 G80 (SAFE START, INCH)
T1 M6 (TOOL CHANGE)
S6000 M3 (SPINDLE ON)
…
The full 10-line example is in the app. Example is in inch. Check offsets and clearances first.
Watch out for
- Write the letter O, not zero, on the sub label. Mach4 sub files in the Subroutines folder are named like O1000 with no extension.
- Put subs after M30 so they are not run by the main flow.
- Q means start line on Mach4 but repeat count on Mach3.
Related codes
M98 on other controls
The same number can mean something different on another control.
| Control | Meaning |
|---|---|
| Fanuc | Subprogram call |
| Haas NGC | Subprogram call |
| Doosan (Fanuc) | Sub program call |
| DMG Mori MAPPS (Fanuc) | Sub-program call in NC memory |
| Mazak (EIA) | EIA → EIA Subprogram call |
| Okuma OSP | Subprogram call (Lathes & Mills) |
| Mitsubishi M70 M80 | Subprogram call |
| Brother Speedio | Subprogram call |
| Heidenhain TNC (ISO) | Machine open contours completely |
| LinuxCNC Tormach | Fanuc style subprogram call |
| Centroid CNC12 Acorn | Call subprogram |
| Hurco WinMax (NC) | Subprogram call |
| Fadal | Execute subprogram |
| Swiss (Citizen Star) | Subprogram call |
Every M-code for Mach3 Mach4 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 M98 in the app All Mach3 Mach4 M-codes