0
0
Ev-technologyConceptBeginner · 3 min read

What is M02 Program End in CNC Programming Explained

In CNC programming, M02 is a command that marks the end of a program. It tells the machine to stop all operations and reset to the program's start point without pausing, unlike M30 which also rewinds the program.
⚙️

How It Works

The M02 command in CNC programming acts like a 'stop sign' at the end of your machining instructions. When the machine reads M02, it knows the program is finished and stops running the code immediately.

Think of it like finishing a recipe: once you reach the last step, you stop cooking. The machine stops moving and turns off the spindle or coolant if they were on. Unlike some other end commands, M02 does not rewind the program to the beginning, so the machine stays at the last position.

💻

Example

This simple CNC program example ends with M02 to stop the machine after completing the toolpath.

gcode
N10 G00 X0 Y0 Z5
N20 G01 Z-1 F100
N30 X50 Y0 F200
N40 X50 Y50
N50 X0 Y50
N60 X0 Y0
N70 M05
N80 M02
Output
The machine moves the tool to start, cuts a square path, stops the spindle at line N70, and then stops the program at N80 without rewinding.
🎯

When to Use

Use M02 when you want the CNC machine to stop precisely at the end of your program without rewinding or resetting the program counter. This is useful when you want to inspect the part or tool position after machining before starting a new program.

For example, if you run a program to cut a part and want to manually check the tool or material before running another program, M02 is ideal. It stops the machine cleanly but leaves it ready for the next command.

Key Points

  • M02 stops the CNC program without rewinding.
  • It ends the program and stops spindle and coolant.
  • Useful for manual inspection after machining.
  • Different from M30, which rewinds the program.

Key Takeaways

M02 marks the end of a CNC program and stops the machine immediately.
M02 does not rewind the program, unlike M30.
Use M02 when you want to stop and inspect the machine or part before running another program.
M02 stops spindle and coolant as part of program completion.