Back to GSM Code List

M00 and M01: stopping the program on purpose

M00 stops the program every time: the control cuts the feed, the spindle rotation and the coolant, and nothing carries on until somebody presses cycle start. M01 does exactly the same, but only if the operator has the optional stop switch on the panel turned on; with it off, the control reads the block and carries straight on. Both are there to put a human step into the middle of the program: turning the part over, measuring, clearing chips or checking a tool.

For reference only: syntax changes with the control, the post-processor and the machine parameters. Check the official manual and run a simulation before cutting. Legal notice.

Family
Program
Machine
Milling, Turning, Mill-turn, Laser/cut
Risk
Low
Example
M01 (CONTROLAR MEDIDA)

Syntax by control

Fanuc (milling and turning)

M00 (GIRAR LA PIEZA Y APRETAR)

The text in brackets is a program comment. Many controls show it on the active block screen when it stops, which is exactly what the operator needs to know what to do; on others you have to use the control's message instruction.

Haas

M01 (MEDIR COTA 40 H7)

The optional stop is switched on and off with the Optional Stop button on the panel, and its state is shown on the screen. Haas also has Block Delete: a block starting with a slash is skipped when that function is on.

Siemens 840D / 828D

M0

Siemens writes M0 and M1 with no leading zero. The optional stop is enabled in the program control window, where dry run and block skip live as well. To put a notice on the screen you use MSG.

Heidenhain TNC (Klartext)

M0

M0 halts execution and M1 is the optional stop, as long as the builder has enabled it. What the operator sees depends on the control version: on some the block comment is enough and on others you have to put it up with a message function.

Address letters used with it

LetterWhat it setsUnit
No address lettersNeither M00 nor M01 takes arguments. They go alone in their block, and the only thing added is a comment explaining to the operator what has to be done.no units
( ) commentText in brackets in the same block. The machine does not run it, but on most controls it is readable on the screen when the program stops there.text
/ (block delete slash)Written in front of the block, it lets the block be skipped when the operator turns block delete on. A /M01 gives you two levels of control over the same stop.no units
Optional stop switchIt is not programmable: it is a button or a checkbox on the panel. It is what decides whether an M01 stops the machine or the control passes straight over it.on / off

Worked example

A plate faced on both sides on the same machine: side A is done, the program stops so the operator can turn the part over and clamp it, and then side B is done. At the end there is an optional stop to measure the thickness on the first part of the run without having to edit the program when it goes into production.

O0100 (PLACA PLANEADA POR LAS DOS CARAS)
( Program header. )
G21 G17 G40 G49 G80
( Millimeters, XY plane and a clean state. )
G91 G28 Z0.
( Z to the reference point in incremental before the change. )
T1 M06 (PLATO DE PLANEAR D63)
( Face mill. )
G90 G54 G00 X-45. Y0. S1800 M03
( Absolute, work offset, positioning clear of the plate and spindle on. )
G43 H01 Z50.
( T1 length offset. )
G00 Z2. M08
( Approach and coolant on. )
G01 Z-0.5 F500
( Depth of cut for side A. )
G01 X145. F1800
( Facing pass on side A. )
G00 Z50. M09
( Retract in Z and coolant off before the stop: the operator has to be able to get his hands in. )
G91 G28 Z0. M05
( Z to the reference point and spindle stop. The stop is prepared, not improvised. )
G90 G53 X0. Y-500.
( In machine coordinates, brings the table out toward the door so the part is within reach. )
M00 (GIRAR LA PIEZA Y APRETAR)
( Mandatory stop: the program does not carry on until somebody presses cycle start. The comment is what the operator reads on the screen. )
G90 G54 G00 X-45. Y0. S1800 M03
( On restarting you have to start the spindle again. Not every control brings it back after a stop, and the ones that do it by parameter. )
G43 H01 Z50.
( The complete state is rebuilt, as in a start from the middle of a program. )
G00 Z2. M08
( Approach and coolant running again. )
G01 Z-0.5 F500
( Depth of cut for side B. )
G01 X145. F1800
( Facing pass on side B. )
G00 Z50. M09
( Retract and coolant off. )
G91 G28 Z0. M05
( Z to the reference point and spindle stop. )
M01 (MEDIR ESPESOR 20 +-0.05)
( Optional stop. With the switch on, the machine waits for the operator to measure the first part; with the switch off, the control does not even notice and the run carries on at its own pace. )
G90 M30
( Back to absolute and end. )
Open the simulator to check the example

Practical keys to using M00/M01 in the workshop

What they are really used for in the shop

M00 is kept for what cannot be skipped: turning the part over, changing the workholding, taking a stop out, fitting an insert or removing a piece of material that would be in the way of the next operation. M01 is for what only matters sometimes: measuring the first part of a run, looking at the edge of a tap before threading fifty holes, pulling long chips out of a pocket. The practical difference is who decides: with M00 the programmer decides and with M01 the operator decides from the panel, without touching the program.

Where the stop goes

Never with the tool in the part. A well placed stop block is preceded by a retract in Z, an M09, an M05 and, if the operator has to reach the part, a positioning move of the table toward the door in machine coordinates with G53. And after the stop the state has to be rebuilt exactly as in a start from the middle of a program: G90, the work offset, the positioning, the S with its M03 and the M08. That recovery block is what separates a clean stop from a scare when cycle start is pressed.

M01 and organizing a production run

The point of M01 is that the same program works for the first part and for number two hundred. With the switch on the control stops at every inspection point; once the process is validated, the operator turns it off and cycle time drops with nothing edited. That is why it pays to sprinkle M01 blocks at the natural check points, always with a comment saying what has to be looked at. And if you want to be able to disable one particular M01 without disabling them all, put the block delete slash in front of it.

Mistakes that cost you a part (or a tool)

  • Putting the M00 in without having retracted the tool: the operator opens the door and finds the cutter buried in the part, centimeters from his hands.
  • Leaving the spindle turning or the coolant running at the stop: most controls shut them off, but there are machines where they do not, and with the door open that is an accident waiting.
  • Assuming M01 always stops the machine: if the optional stop switch is off, the control walks straight past. Anything that is essential goes with M00.
  • Not restarting the spindle and the coolant after the stop: on resuming, the tool goes into the part without turning and without coolant.
  • Using M00 where M01 belonged: the whole run stops on every part and the operator ends up editing the program at the machine, which is how good versions get lost.
  • Putting an M00 or an M01 inside a subprogram that repeats: the program stops on every call and nobody understands why.
  • Assuming the stop cancels the modal state: on resuming, the same work offset, the same compensation and the same canned cycle are still active.

Frequently Asked Questions (FAQ)

What is the difference between M00, M01, M02 and M30?

M00 stops the program in the middle and waits for cycle start to carry on. M01 does the same but only if the optional stop is switched on. M02 and M30 end the program: the classic difference between them is that M30 also rewinds to the beginning and leaves the control ready for the next part.

How do you resume the program after an M00?

By pressing cycle start. The control carries on at the next block and keeps the modal state it had: the same work offset, the same absolute or incremental mode and the same offsets. What it does not reliably keep is the spindle rotation and the coolant, so the program has to command them again.

Does the spindle stop with M00?

On most controls yes: the stop cuts the feed, the rotation and the coolant. Even so it is builder behavior, not a guarantee of the code, and that is why the shop habit is to write M05 and M09 right before the M00 and start them again afterwards.

Where is the optional stop switched on?

On the machine panel: on Haas it is the Optional Stop button, on Fanuc a switch or a key on the operation screen, and on Siemens a checkbox in the program control window. The state is always visible on the screen, and it is not stored in the program.

Can I show the operator a message when it stops?

Yes. The simple way is to write a comment in brackets in the same block, which on many controls is readable on the active line. If you need a more visible notice, every control has its own message instruction, such as MSG on Siemens. Either way, the text should say what to do, not just that there is a stop.

Related codes

Other codes in Program

See the full list of G and M codes

Related tools