M00, M01, M02, M30: Complete CNC Program Stop and End Guide
Master M00, M01, M02, and M30 program stop and end commands on Fanuc, Siemens, and Mitsubishi. Prevent collisions, adjust parameters, and resolve alarms.
Introduction
A single unpressed button on a CNC operator panel can stand between a flawless production run and a shattered spindle. When an operator fails to engage the "Optional Stop" toggle on the control face, a programmed M01 mid-cycle inspection command is completely bypassed by the interpreter. The machine moves at rapid traverse directly into the next operation, plunging a high-speed tool into an improperly seated workpiece. Within seconds, the tool strikes a heavy steel vise jaw or a stationary fixture clamp, resulting in a devastating hard collision, a cracked turret axis, and a completely ruined scrap part. Safely managing the pacing and termination of machining cycles using M00 (Program Stop), M01 (Optional Stop), M02 (Program End), and M30 (Program End & Rewind) is not just a matter of syntax; it is a critical safeguard governing the hardware handshake between the CNC interpolator and the machine's Programmable Logic Controller (PLC). To understand how this fits with coordinate positioning, see the G94 and G95 Feed Rate Modes guide.
Technical Summary
| Technical Specification | Details |
|---|---|
| Command Codes | M00, M01, M02, M30 |
| Modal Group | Non-modal (active only in the block where programmed) |
| Supported Brands | Fanuc, Siemens, Mitsubishi |
| Critical Parameters | Fanuc Parameter 3404 (Rewind behavior), Siemens MD 22254 / MD 22256 (Custom stop M-codes), Mitsubishi Parameter #12005 (Maximum M-codes per block) |
| Main Constraint | Peripheral stops (spindle, coolant) are governed by the specific Machine Tool Builder's PLC ladder logic rather than the base CNC specifications; must not be programmed inside Siemens stop delay areas (Alarm 16954). |
Quick Read
- Verify HMI Panel State: Always check that the "Optional Stop" toggle is active on the operator HMI before running programs that rely on
M01for part measurements. - Isolate End Commands: Write
M02andM30in their own dedicated blocks to prevent PLC hardware handshake failures with auxiliary functions like bar feeders or workpiece counter logic. - Avoid Stop Delay Areas: Never program
M00orM01during active thread cutting or rigid tapping cycles to prevent synchronization loss and Siemens alarm 16954. - Check Parameter 3404: Configure Fanuc Parameter 3404 (bit 4 for
M30, bit 5 forM02) to control whether execution automatically rewinds to the program head or halts for an external signal. - Match Handshake Signals: Ensure the Mitsubishi PLC ladder is set to return a Reset & Rewind (RRW) signal for
M02andM30rather than a standard FIN1/FIN2 signal, which causes alarm P36. - Watch Look-Ahead Blocks: Recognize that
M00,M01,M02, andM30actively inhibit the pre-read look-ahead buffer on Fanuc, Siemens, and Mitsubishi to prevent premature execution of subsequent code.
Basic Concepts
Program stop and end commands are the primary logical interfaces that divide, pace, and safely terminate automatic CNC operations. Unlike motion commands that directly drive feed motors or interpolation paths, M00, M01, M02, and M30 communicate directly with the machine's Programmable Logic Controller (PLC) using hardware handshake relays. These commands enforce a rigid operational boundary, ensuring that subsequent coordinates or tooling instructions cannot be executed until specific operator actions or automated reload sequences have successfully completed.
The stop commands, M00 and M01, function as mid-cycle pauses. M00 represents an unconditional stop that immediately halts the CNC interpreter, freezes axis motion, and suspends program execution. This pause is designed for manual operator interventions, such as checking a critical tolerance with micrometers, cleaning accumulated metal chips from a deep slot, or manually flipping a workpiece. Conversely, M01 acts as a conditional stop, pausing the cycle only if the machine operator has actively toggled the "Optional Stop" switch on the controller's hardware console. If the optional stop toggle is inactive, the controller treats M01 as a comment and executes the next block without hesitation.
The program end commands, M02 and M30, represent the physical termination of the part program. Both codes signal to the CNC control and the underlying PLC that all machining operations for the current workpiece are finished. This triggers the system to stop the spindle, turn off high-pressure coolant pumps, and reset internal registers. M30 specifically cues the control to rewind the part program back to the very first block, preparing the CNC to execute the cycle immediately on the next piece when the cycle start button is pressed. For a complete understanding of cycle return levels, consult the G98 and G99: Cycle Return Levels guide.
Command Structure
The programming of stop and end auxiliary functions is simple, but requires absolute syntax isolation to guarantee proper hardware sequence execution. Because program stops and terminations trigger critical hardware changes—such as spindle relays, safety door interlocks, and bar-loader handshakes—the control must evaluate them under specific look-ahead constraints. Writing these commands incorrectly or combining them with conflicting motion paths is a primary source of controller parsing errors.
For optimal reliability, M00, M01, M02, and M30 should be programmed in their own dedicated NC block, separated from motion coordinates. While most systems allow them to be appended to a movement line, doing so forces the control to resolve the motion and the auxiliary stop simultaneously, which can cause erratic timing behavior depending on how the machine tool builder has written the PLC ladder logic. Additionally, these codes are classified as non-buffering, meaning the interpolator is barred from reading or preparing any subsequent blocks until the M-code execution has finished.
Programming Syntax:
M00 ; Unconditional Program Stop
M01 ; Optional Program Stop
M02 ; Program End
M30 ; Program End with Rewind to Head
Parameters & System Settings:
| Brand | System Identifier | Functional Setting |
|---|---|---|
| Fanuc | Parameter 3404 Bit 4 (M30) | 0: Automatically rewind to head; 1: Wait for external Reset & Rewind signal. |
| Fanuc | Parameter 3404 Bit 5 (M02) | 0: Automatically rewind to head; 1: Wait for external Reset & Rewind signal. |
| Fanuc | Parameter 3201 Bit 6 (NPE) | 0: Cease data reception immediately on M02, M30, M99; 1: Ignore end codes. |
| Fanuc | Parameter 3204 Bit 6 (MKP) | 0: Clear active MDI sequence when M02/M30 executes; 1: Retain MDI program. |
| Siemens | MD22254 $MC_AUXFU_ASSOC_M0_VALUE | Defines an additional, customized M function for unconditional program stop. |
| Siemens | MD22256 $MC_AUXFU_ASSOC_M1_VALUE | Defines an additional, customized M function for conditional program stop. |
| Siemens | MD10714 $MN_M_NO_FCT_EOP | Defines a customized M function to keep the spindle active after reset/end. |
| Siemens | $AC_ACTUAL_PARTS | Active workpiece counter system variable, automatically incremented by M02/M30. |
| Mitsubishi | #12005 Mfig | Determines the maximum number of M-codes allowed in a single block (Range 1 to 4). |
| Mitsubishi | #1278 ext14/bit1 | 0: Normal PLC handshake wait; 1: High-speed completion method. |
| Mitsubishi | #1405 M_mode(SMLK) | Enables or disables auxiliary M-code output during high-speed simple program checks. |
Brand Applications
Fanuc
Fanuc CNC systems rely on dedicated hardware-level parameters to determine how program stops and ends interact with active memory registration and external data transfer. Parameter 3404 bit 4 dictates the rewind behavior for M30, while parameter 3404 bit 5 governs the rewind behavior for M02. Setting these bits determines whether the controller automatically repositions the memory pointer to the head of the file or halts until external relays signal a manual reset.
On Fanuc controls, M00, M01, M02, and M30 are programmed in standard format, isolated inside a block to guarantee look-ahead inhibition. On lathe systems, developers must monitor parameter NPE to prevent data corruption during serial transfers.
| System Category | Setting / Alarm Code | Description and Hardware Behavior |
|---|---|---|
| System Parameters | Parameter 3404 bit 4 (M30) | Controls the automatic rewind behavior when M30 is executed in memory. A value of 0 auto-rewinds to the head; a value of 1 waits for an external reset and rewind signal. |
| System Parameters | Parameter 3404 bit 5 (M02) | Controls the automatic rewind behavior when M02 is executed. A value of 0 auto-rewinds; a value of 1 waits for an external reset and rewind signal. |
| System Parameters | Parameter 3201 bit 6 (NPE) | 0: Stops part program registration and closes communication ports when reading M02, M30, or M99; 1: Continues receiving without stopping. |
| System Parameters | Parameter 3204 bit 6 (MKP) | 0: Automatically deletes the active MDI screen sequence upon executing M02, M30, or %; 1: Prevents deletion and retains MDI code. |
| Alarms / Errors | PS5010 (END OF RECORD) | Triggered if the end-of-record mark (%) is read during program execution without a preceding M02 or M30 program end command when Parameter 3404 bit 6 is 0. |
| Alarms / Errors | PS0008 (ILLEGAL USE) | Triggered specifically on M-series controls if an attempt is made to execute the EOR (%) mark because an M02, M30, or M99 was missing. |
| Alarms / Errors | PS5016 (ILLEGAL COMBINATION) | Triggered if multiple M-codes of the same group are specified in a single block or combined with an end command. |
| Version Differences | Legacy Systems (0-Series) | Legacy Fanuc controllers use parameter 0019 bit 5 (M02NR) to control M02 rewind behavior, which modern controls migrated to parameter 3404 bit 5. |
Warning: Omitting an M02 or M30 at the end of a Fanuc part program will cause the reader to reach the End of Record (%) mark, instantly trapping the execution and throwing a PS5010 or PS0008 alarm to prevent unpredictable memory overruns.
Siemens
Siemens SINUMERIK controllers provide a flexible syntax structure that integrates stop commands directly with workpiece tracking and measuring cycle safety. The control natively updates system variables like $AC_ACTUAL_PARTS and $AC_SPECIAL_PARTS when M02 or M30 is processed, bypassing the need for custom macro counters. Additionally, Siemens uses machine data MD22254 and MD22256 to allow machine builders to define customized stop M-functions.
Siemens syntax supports both M0/M1 and M00/M01 block formats. These codes can be written alongside movement commands, though strict formatting restrictions apply to program end blocks.
| System Category | Setting / Alarm Code | Description and Hardware Behavior |
|---|---|---|
| System Parameters | MD22254 $MC_AUXFU_ASSOC_M0_VALUE | Machine data used to define an additional, customized auxiliary M function for an unconditional program stop. |
| System Parameters | MD22256 $MC_AUXFU_ASSOC_M1_VALUE | Machine data used to define an additional, customized auxiliary M function for a conditional program stop. |
| System Parameters | MD10714 $MN_M_NO_FCT_EOP | Defines a customized M function (such as value 32) to keep the spindle active and running after a reset or program end. |
| System Parameters | $AC_ACTUAL_PARTS | Active workpiece counter system variable, automatically incremented by 1 when M02 or M30 is executed. Range: 0 to 999,999,999. |
| Alarms / Errors | Alarm 16954 | Programmed stop (M0/M1) prohibited in stop delay area. Triggered if a stop command is encountered inside synchronized thread cutting or rigid tapping. |
| Alarms / Errors | Alarms 62304 / 62305 / 62306 | Oversize, undersize, or permissible difference exceeded. During measuring cycles, if a tolerance is violated, the control automatically injects an implicit M00 pause. |
| Version Differences | Subprogram Nesting | Siemens treats M02 and M30 in called main programs identically to M17 subprogram returns, seamlessly returning execution to the parent calling program block. |
Warning: Placing M00 or M01 inside stop delay zones, such as during rigid tapping or thread cutting, breaks interpolator-spindle synchronization and triggers Alarm 16954, leaving a snapped tap permanently wedged in a high-value workpiece.
Mitsubishi
Mitsubishi CNC systems handle stop and end commands using a highly structured, dedicated handshake signal interface that communicates directly with the PLC. Unlike other brands that share generic strobe signals for auxiliary functions, Mitsubishi outputs independent dedicated signals to the PLC when M00, M01, M02, or M30 are read. This allows for specialized machine-side logic, such as unlocking safety enclosure doors during stops.
Mitsubishi G-code programs use standard 8-digit M-code syntax structures. Axis movements and stop commands can be executed in the same block, with the order of execution determined entirely by the machine builder's PLC ladder logic.
| System Category | Setting / Alarm Code | Description and Hardware Behavior |
|---|---|---|
| System Parameters | Parameter #12005 Mfig | Determines the maximum number of M-codes that can be issued in a single block. Supports up to 4 codes; later M-codes overwrite earlier ones if exceeded. |
| System Parameters | Parameter #1278 ext14/bit1 | 0: Normal completion method (waits for PLC finish signal); 1: High-speed completion method to shorten cycle times. |
| System Parameters | Parameter #1405 M_mode(SMLK) | Enables or disables the physical auxiliary M-code signal output during a high-speed simple program check. |
| Alarms / Errors | Alarm P36 (Program Error) | Triggered at program end if the PLC incorrectly sends back a standard FIN1/FIN2 strobe signal after M02/M30 instead of the mandatory Reset & Rewind (RRW) signal. |
| Alarms / Errors | Alarm M01 (Operation Alarm) | Triggered if the operator physically presses the cycle start button while the CNC is actively running in program check mode. |
| Version Differences | Hardware Variations | Legacy display units cannot display all eight digits of the programmed M-code. System reset via M00 and rewind via M02/M30 are strictly machine-tool-builder specific. |
Warning: Programming the PLC ladder to return a standard FIN1 or FIN2 strobe finish signal for M02 or M30 instead of the mandatory Reset & Rewind (RRW) signal violates the termination sequence and generates a P36 program error.
Brand Comparison
| Topic / Feature | Fanuc | Siemens | Mitsubishi |
|---|---|---|---|
| Look-Ahead / Pre-Read Buffer | Physically barred from reading past M00/M01/M02/M30, completely regardless of active buffering parameters. | Pauses the interpolator and axis motion immediately when M00 or M01 is processed in the execution block. | Intentionally halts the pre-reading buffer immediately to prevent subsequent coordinates from prematurely triggering. |
| PLC Handshaking / Feedback | Handled via parameter 3404 bits to toggle between auto-rewind and waiting for external Reset & Rewind hardware signals. | Intricately tied to HMI optional stop panel VDI state; PLC logic configuration controls active spindle/coolant pause behavior. | M00 and M01 require FIN1/FIN2 strobe signals to proceed; M02 and M30 demand a mandatory Reset & Rewind (RRW) signal. |
| Nesting & Program End Returns | M02 and M30 always terminate the memory execution of the active file level. | Nested main program (called as subprogram) automatically turns M02/M30 into an M17 subprogram return block. | M98/M99 subprograms are handled internally; M02 and M30 always cue up the head of the program per MTB specifications. |
| Integrated Production Tracking | Requires manual program counters or customized external PLC logic programming. | Natively increments system variable counters $AC_ACTUAL_PARTS and $AC_SPECIAL_PARTS by 1 upon M02 or M30 execution. | Counter tracking is not native; requires machine-tool-builder PLC ladder configuration or custom macro intervention. |
Technical Analysis
An analytical comparison of how Fanuc, Siemens, and Mitsubishi handle stop and end commands reveals fundamentally different control philosophies regarding look-ahead buffering, PLC handshaking, and nesting behavior. While all three brands ultimately halt motion and cue up the head of a program, the underlying computational processes they execute are tailored to their respective system architectures.
The handling of the pre-read look-ahead buffer represents a major point of divergence. Fanuc treats M00, M01, M02, and M30 as strict barriers. The control's look-ahead calculation is physically barred from reading past these commands, regardless of buffering parameter settings. This ensures that coordinate math is completely frozen. Siemens approach is similarly immediate, pausing the interpolator and axes when M00 or M01 is processed in the active execution block. Mitsubishi, on the other hand, enforces an aggressive pre-read buffer inhibition, halting the pre-reading buffer immediately upon encountering these specific M-codes to ensure subsequent geometric moves cannot be pre-loaded and prematurely trigger machine-side reactions.
The feedback loop between the CNC processor and the PLC cabinet also varies. Fanuc delegates rewind control to parameter 3404, allowing the machine builder to decide if the CNC automatically rewinds or waits for an external Reset & Rewind hardware relay. Siemens relies on HMI optional stop panel states, leaving the physical spindle and coolant reactions entirely up to the PLC logic. Mitsubishi utilizes a unique "M-code independent output" structure, outputting dedicated signals directly to the PLC. Mitsubishi also alters the required feedback, requiring a standard finish signal (FIN1/FIN2) for stops but demanding a mandatory Reset & Rewind (RRW) handshake to terminate cycles. Failing to match these PLC handshakes results in a P36 program error.
Finally, program nesting highlights the flexibility of the Siemens interpreter. In Siemens controls, if a main program containing M02 or M30 is called as a subprogram by another file, the interpreter automatically treats these end commands as M17 subprogram returns. This allows developers to nest legacy main files without modifying their code. Fanuc and Mitsubishi lack this fluid nesting translation; an M02 or M30 will terminate memory execution at the current level, requiring programmers to use dedicated subprogram call and return structures like M98 and M99. To understand how feedrates interact with these modes, refer to the G96 and G97: Constant Surface Speed and Constant RPM guide.
Program Examples
Fanuc Program Example
O1001 (FANUC STOP & END EXAMPLE) ;
N10 G90 G21 G17 ;
N20 T0101 M06 (Select Tool 1, load tool) ;
N30 G54 G00 X0 Y0 S1200 M03 ;
N40 G43 H01 Z25.0 M08 (Enable tool length comp, coolant ON) ;
N50 G01 Z-5.0 F150. ;
N60 X50.0 ;
N70 G00 Z25.0 M09 (Retract tool, coolant OFF) ;
N80 M00 (Unconditional Stop - Operator clears chips and checks part seating) ;
N90 G00 X100.0 Y100.0 ;
N100 T0202 M06 ;
N110 S1500 M03 M08 ;
N120 G00 Z5.0 ;
N130 G01 Z-2.0 F200. ;
N140 X150.0 ;
N150 G00 Z50.0 M05 M09 ;
N160 M30 (Program end and auto-rewind to block O1001) ;
%
Dry Run Breakdown
- Tool States: Spindle rotates at 1200 RPM under M03, coolant activates under M08. Spindle stops at Block N150 under M05, coolant shuts off under M09.
- Operator Actions: During block N80 (M00), the operator opens the door, clears chips, measures the pocket, and verifies part seating before closing the door and pressing CYCLE START.
- PLC Responses: Upon reading M00 at N80, the PLC triggers spindle and coolant relays to turn OFF and freezes axes feed. Upon reading M30 at N160, the PLC completes the end cycle and, as governed by Parameter 3404 bit 4 set to 0, automatically rewinds the program pointer back to the top at O1001.
Siemens Program Example
; SIEMENS M00/M30 PROGRAM STOP & END WORKPIECE
N10 G90 G71 G17
N20 T="END_MILL_10" D1 M6
N30 G54 S1800 M3
N40 G0 X0 Y0 Z30.0 M8
N50 G1 Z-8.0 F250.
N60 Y80.0
N70 G0 Z30.0 M9
N80 M01 ; Conditional stop - Operators toggle HMI to inspect part dimensions
N90 G0 X120.0 Y50.0
N100 G1 Z-4.0 F300.
N110 X200.0
N120 G0 Z100.0 M5 M9
N130 G53 X0 Y0 D0 ; Return to machine zero
N140 M30 ; Program end, resets control, increments $AC_ACTUAL_PARTS counter
Dry Run Breakdown
- Tool States: Spindle runs at 1800 RPM in block N30, coolant active in N40. Both are deactivated in block N120 before machine zero return.
- Operator Actions: If the "Optional Stop" toggle on the Siemens HMI is ON, the machine pauses at block N80. The operator checks the tool wear and pocket depth, then presses NC START. If the toggle is OFF, block N80 is completely bypassed.
- PLC Responses: The control processes M01 at N80. If optional stop is active, the PLC suspends interpolator pulses. At block N140, the PLC executes the program end sequence, resets the modal registers, and automatically increments the $AC_ACTUAL_PARTS workpiece counter by 1.
Mitsubishi Program Example
; MITSUBISHI M00/M30 DEDICATED PLC HANDSHAKE
N10 G90 G21
N20 M06 T1
N30 G54 G00 X0 Y0 S1000 M03
N40 G43 H1 Z20. M08
N50 G01 Z-10. F180.
N60 X100.
N70 G00 Z20. M09
N80 M00 ; Dedicated PLC pause - door safety unlock trigger
N90 G00 X0 Y0
N100 M30 ; Cycle end demanding RRW handshake
Dry Run Breakdown
- Tool States: Tool 1 active. Spindle runs at 1000 RPM, coolant ON. Spindle and coolant deactivated at program termination block N100.
- Operator Actions: During the M00 pause at block N80, the CNC halts. The safety interlock unlocks, allowing the operator to inspect the part, close the door, and press CYCLE START.
- PLC Responses: The M00 command outputs a dedicated, independent signal to the PLC. The PLC triggers the safety door lock relay to unlock. At block N100, the PLC initiates a Reset & Rewind (RRW) handshake to the controller, resetting the system to block N1.
Error Analysis
| Brand | Alarm Code | Trigger Condition | Operator Symptom | Root Cause / Fix |
|---|---|---|---|---|
| Fanuc | PS5010 (END OF RECORD) | Execution of EOR (%) mark without a preceding M02 or M30 when Parameter 3404 bit 6 is 0. | CNC screen displays PS5010 END OF RECORD, and automatic operation instantly halts. | Ensure a proper M02 or M30 program end command is written immediately before the trailing % character. |
| Fanuc | PS0008 (ILLEGAL USE) | Execution of EOR (%) mark on M-series controls without a preceding M02, M30, or M99. | Red alarm lamp lights up, program execution halts abruptly. | Edit the program to insert an M30 or M02 in its own block before the trailing % symbol. |
| Fanuc | PS5016 (ILLEGAL COMBINATION) | Multiple M-codes of the same group programmed in one block, or combining end commands with other M-codes. | The controller generates alarm PS5016 and refuses to parse the block. | Move the program end command (M02/M30) to its own isolated block with no other M-codes. |
| Siemens | Alarm 16954 | Programmed stop (M0/M1) encountered inside a protected stop delay area (e.g., during tapping). | System throws Alarm 16954: Programmed stop prohibited, and motion halts midway. | Move M0/M1 outside synchronized tapping, threading, or contouring cycles. |
| Siemens | Alarm 62304 / 62305 | Workpiece dimension measuring cycle detects a tolerance violation (oversize/undersize). | Program execution suspends with an implicit M00 halt, HMI displays warning. | Adjust tool wear offsets on the control panel and press NC START to resume execution safely. |
| Mitsubishi | Alarm P36 (Program Error) | PLC logic incorrect; returns a standard FIN1/FIN2 strobe signal for M02/M30 instead of Reset & Rewind (RRW). | Part program terminates, but machine halts in a fault state with code P36 active. | Modify the PLC ladder program so that M02 and M30 trigger a Reset & Rewind (RRW) handshake to the CNC. |
| Mitsubishi | Alarm M01 (Operation Alarm) | Operator presses the cycle start button while the CNC is actively running in program check mode. | Controller generates a flashing M01 alarm on the screen; cycle start is ignored. | Wait for the program check routine to reach M02 or M30 before attempting to run the machine. |
Application Note
A devastating hard collision occurs the instant a high-speed tool crushes into a solid steel vise jaw because an operator overlooked the "Optional Stop" toggle while relying on an M01 block for manual workpiece alignment. When this interlock is bypassed, the machine ignores the conditional pause and plunges into the fixture, yielding a completely ruined scrap part and severely misaligning the turret. Similarly, inserting an M00 or M01 during a synchronized rigid tapping sequence instantly breaks the electronic gearing, triggering Siemens Alarm 16954 and leaving a snapped tap permanently wedged in a high-value workpiece. In the control cabinet, a mismatched electrical handshake—where a Mitsubishi PLC ladder returns a standard finish strobe (FIN1 or FIN2) instead of a dedicated Reset & Rewind (RRW) signal at the completion of an M30 block—guarantees a system hang and throws a P36 program error. Machinists must systematically isolate stop commands in independent NC blocks, verify active screen indicators, and ensure PLC handshake timings match the specific requirements of the controller brand.
Related Command Network
- M98 / M99 (Subprogram Call & Return): M98 calls an external subprogram block, while M99 terminates the subprogram and returns execution control back to the primary calling program.
- M17 (Siemens Subprogram Return): Serves as the native subprogram end and return command in Siemens controllers, returning processing flow to the higher-level calling program block.
- M03 / M04 / M05 (Spindle Controls): Control spindle rotation clockwise, counter-clockwise, and stop, respectively, and are typically programmed to turn off in conjunction with or immediately prior to program stops.
- EOR / % (End of Record): Acts as the physical file boundary mark for part program data transfer, signaling the memory reader to cease scanning and preventing file overrun errors.
Conclusion
Implementing proper M00, M01, M02, and M30 commands transforms loose G-code files into tightly structured, secure, and predictable machining processes. By treating these stop and end functions as structural interlocks rather than simple text characters—meticulously isolating them in separate blocks, matching PLC hardware handshake feedback, and configuring controller parameters such as Fanuc 3404—programmers establish a solid foundation for collision-free manual checks and automated parts counting.
Frequently Asked Questions
What is the physical difference between M00 and M01 on a CNC machine?
M00 is an unconditional stop that halts axis movement, spindle rotation, and coolant flow every single time it is parsed, whereas M01 is a conditional stop that is only recognized if the operator has turned on the "Optional Stop" switch on the physical control panel. Always verify the status of the Optional Stop toggle on the machine panel before initiating a cycle that contains mid-process inspection points.
Why does my CNC machine trigger a P36 alarm when M30 is executed?
On Mitsubishi controllers, a P36 alarm occurs if the machine's PLC sends a standard auxiliary finish strobe (FIN1 or FIN2) instead of the mandatory Reset & Rewind (RRW) handshake signal back to the CNC processor when M02 or M30 is executed. Consult the machine tool builder's PLC documentation or modify the ladder logic to ensure that program termination codes correctly trigger the RRW register rather than generic finish signals.
Can M02 and M30 be programmed in the same block as other movement commands?
While most CNC controllers allow end commands to be programmed alongside coordinate motions, doing so frequently prevents proper hardware execution of peripheral functions like bar loaders or workpiece counters because the PLC requires a separate scan line to process the end state. Program all M02 and M30 end commands strictly in their own dedicated blocks, separated from motion coordinates and other auxiliary M-codes, to guarantee clean PLC handshakes and avoid execution conflicts.
Still not resolved?
Ask our AI assistant about this topic in natural language. Grounded in verified sources, no hallucinations.

- CNC CARE Co-Founder (May 2025 - Present)
- Mitsubishi Electric NC Sales & Service Section Manager (2008 - 2025)
- Reis CNC Service Engineer (2003 - 2005)
- Ören Kalıp CNC Mold Line Team Leader (1999 - 2002)
With over 25 years of experience working in all areas of the CNC machine industry, I continue my activities as a co-founder of CNC CARE, where we offer brand-independent consulting, engineering, and original spare parts services.
Related Articles
Other articles on this topic
Siemens CYCLE800 G-Code: Swivel Planes & Tool Alignment
Master Siemens CYCLE800 for 3+2 axis machining. Learn plane swiveling, tool alignment, parameter setup, and how to troubleshoot Alarm 61190 and 61153.
Siemens CYCLE72 Contour Milling: Guide to Sinumerik Path Milling
Master Siemens CYCLE72 for contour milling on Sinumerik CNC controls. Learn parameter setup, avoid simulation alarm 61123, and prevent machine collisions.
Siemens CYCLE952 Contour Turning Cycle Programming Guide
Master Siemens CYCLE952 contour turning on Sinumerik CNC controls. Learn parameter lists, resolve Alarm 61051, and configure balance cutting.
Siemens SLOT1 and SLOT2 Slot Milling Cycles Programming Guide
Master slot milling on Siemens Sinumerik controls using SLOT1 and SLOT2 cycles. Learn parameter configurations, alarm 61000 prevention, and optimal tool paths.