M198 is one of the most powerful and flexible CNC commands for automated manufacturing because it allows a machine to execute a subprogram stored externally—usually on a USB drive or memory card—without loading it into internal storage. This enables true plug-and-play workflows, fast job switching, automated part families, and highly scalable production environments. M198 is extremely valuable for shops that run multiple part variants, robot-driven cells, unattended production, or multi-fixture setups where each fixture uses its own subprogram.
1. What M198 Actually Does
M198 tells the CNC control: “Go to the external device, search for the specified program number, and execute it as a subprogram.”
This allows operators to store dozens or hundreds of part programs on a USB without filling the machine’s internal memory.
M198 can be used to:
- Run a specific .NC file from USB
- Loop multiple part programs
- Run different offsets per fixture
- Drive automation macros
- Change programs rapidly without uploading
2. Basic Syntax (Haas Example)
M198 P####
P = program number on the USB.
Example:
M198 P1001
Executes program 1001.NC directly from the USB.
3. Real Production Example – Multi-Fixture Setup
Imagine a tombstone with 4 faces.
Each face has its own subprogram stored on the USB:
1001.NC → Face 1
1002.NC → Face 2
1003.NC → Face 3
1004.NC → Face 4
Main program:
G54
M198 P1001
G55
M198 P1002
G56
M198 P1003
G57
M198 P1004
This structure allows a single master program to run all fixtures automatically.
4. Looping External Programs for Lights-Out Machining
You can also loop external subprograms for fully autonomous operation:
100 = 10
WHILE[#100 GT 0] DO1
M198 P2000
#100 = #100 – 1
END1
This runs program 2000.NC ten times without ever loading it internally—ideal for robotic part loading.
5. Fanuc Usage
Fanuc uses a similar format:
M198 P1001
with the USB mapped as device “CNC_MEM2” or “CNC_MEMCARD”.
Fanuc also supports:
M98 → internal call
M198 → external call
This makes external management consistent and predictable.
6. Common Mistakes and How to Avoid Them
Machine can’t find the file:
– Program number does NOT match the file name
– File extension must be .NC or .TXT depending on control
– USB must be FAT32 formatted
Program freezes on call:
– Subprogram contains its own M30 instead of M99
– Missing return point
Machine runs wrong file:
– Multiple files with same program number exist
– Old files not deleted from USB
Slow loading:
– Use smaller subprograms
– Avoid massive macro loops inside USB programs
7. Why M198 Is Essential in 2025
As shops move toward automated manufacturing, M198 eliminates bottlenecks by:
- Enabling large program storage externally
- Allowing fast product changeover
- Keeping machines running without operator intervention
- Creating reusable “program libraries” on USB
- Supporting robot-fed and lights-out workflows
Large aerospace shops use M198 to manage hundreds of programs per fixture.
Medical shops use M198 to run a family of sizes from a single master program.
Toolmakers use it to store standard cycles externally.
8. Summary
M198 is a key command for modern CNC automation. By enabling external subprogram execution, it allows high-flexibility workflows, reduces internal memory usage, increases reliability, and supports full lights-out production. Any shop using advanced automation, multi-fixture setups, or large program libraries should master M198 to unlock its full potential.
Leave a comment