Overview - Subprogram call (M98) and return (M99)
What is it?
Subprogram call (M98) and return (M99) are commands used in CNC programming to run a separate block of code, called a subprogram, from the main program. M98 tells the machine to jump to a subprogram and start executing it. M99 tells the machine to finish the subprogram and return to the main program where it left off. This helps organize complex machining tasks into smaller, reusable pieces.
Why it matters
Without subprogram calls, CNC programs would be long and repetitive, making them hard to write, read, and maintain. Subprograms let programmers reuse code for repeated tasks, saving time and reducing errors. This makes machining more efficient and flexible, especially for complex parts or batch production.
Where it fits
Before learning M98 and M99, you should understand basic CNC programming commands and program structure. After mastering subprogram calls, you can learn about parameter passing, nested subprograms, and advanced program flow control to create more dynamic CNC programs.
