Back to Supported G-Codes

M0 - Program Pause

DMC File Mode: Not Supported
Streaming Mode: Supported

Description

The M0 command pauses program execution in streaming mode. When encountered, the G-code processing queue stops executing commands and waits for a resume signal. This is useful for manual interventions, tool changes, or inspection during automated operations.

Syntax

M0

Resuming Execution

After an M0 command pauses execution, you can resume processing by calling the Resume()method on your GCodeStreamer instance:

// C++ API call to resume execution
streamer.Resume();

Note: The Resume() method is only available in streaming mode and has no effect if the program is not currently paused by an M0 command.

Examples

Basic Program Pause

G1 X10 Y10 F500
; Move to position
M0
; Pause for inspection
G1 X20 Y20
; Continue after resume

Tool Change Sequence

G1 X50 Y50 Z5 F1000
; Position for drilling
M3 S1000
; Start spindle
G1 Z-10 F200
; Drill hole
G1 Z5
; Retract
M5
; Stop spindle
M0
; Pause for tool change
M3 S2000
; Resume with new tool

C++ Implementation Example

// Add commands including pause
streamer.AddGCodeCommand("G1 X10 Y10 F500");
streamer.AddGCodeCommand("M0"); // Pause here
streamer.AddGCodeCommand("G1 X20 Y20");
streamer.Start();
// Later, resume execution
streamer.Resume();