To stop a running program temporarily (regardless of the setting of the optional stop switch), program: M0.
To stop a running program temporarily (but only if the optional stop switch is on), program: M1.
It is OK to program M0 and M1 in MDI mode, but the effect will probably not be noticeable, because normal behavior in MDI mode is to stop after each line of input, anyway.
If a program is stopped by an M0, M1, pressing the cycle start button will restart the program at the following line.
To end a program, program: M2 or M30. M2 leaves the next line to be executed as the M2 line. M30 "rewinds" the G-code file. These commands can have the following effects depending on the options chosen on the Configure > Logic dialog:
- Axis offsets are set to zero (like G92.2) and origin offsets are set to the default (like G54).
- Selected plane is set to XY (like G17).
- Distance mode is set to absolute (like G90).
- Feed rate mode is set to Units per minute mode (like G94).
- Feed and speed overrides are set to ON (like M48).
- Cutter compensation is turned off (like G40).
- The spindle is stopped (like M5).
- The current motion mode is set to G1 (like G1).
- Coolant is turned off (like M9).
No more lines of code in the file will be executed after the M2 or M30 command is executed. Pressing cycle start will resume the program (M2) or start the program back at the beginning of the file (M30).