Printed from Kezuriba (kezuriba.net/en/nc/m30/)
M30
Machining center, LatheProgram end and rewind (end of tape)
Format and notes
M30
- Ends the program and returns to the top. The next start begins from the beginning
- Whether the spindle and coolant stop after the end, and how modal information is reset, depends on the machine (Siemens ISO)
- On Haas it is also linked to settings such as the part counter (Setting 2, 39, 56, 83, etc.)
M00–M02, M30, M98 and M99 stop, end or call programs, and their meaning is almost the same in all the sources we checked (sources that differ are listed in the table below). M98 and M99 are handled inside the CNC (the Siemens ISO dialect manual treats M90–M99 as CNC-internal). Most other M codes are assigned by the machine builder.
Differences between controls and machines
The same code can be written or assigned differently depending on the CNC control and the machine builder. Always check your machine’s manual.
| Source | Machine | Item | Detail |
|---|---|---|---|
| NIST | Machining center | Meaning | Pallet change + program endIn RS274/NGC, M30 is defined as including a pallet shuttle exchange |
Frequently asked questions about M30
- What is M30 (Program end and rewind (end of tape)) used for and how is it formatted in a CNC program?
- M30 commands "Program end and rewind (end of tape)" on Machining center, Lathe. The standard program format is "M30". Ends the program and returns to the top. The next start begins from the beginning
- Is M30 a modal code or a one-shot (non-modal) code?
- Whether M30 acts modally or as a single-block command depends on the CNC control and the machine builder’s PLC ladder implementation. Check your machine’s active modal status screen and programming manual before running in auto mode.
- Does M30 work differently on machining centers (mills) versus CNC lathes?
- M30 is primarily used on Machining center, Lathe. Depending on the machine type and the lathe G-code system (System A, B, or C), this code may be unavailable or assigned to a different function, so verify against your machine tool manual.
- Are there differences in M30 across FANUC, Mitsubishi, Okuma, Haas, and Siemens controls?
- Yes. Control builders such as FANUC, Mitsubishi Electric (M80/M800), Okuma (OSP), Haas, Mazak, Siemens (SINUMERIK ISO dialect), and Heidenhain can differ in argument letters, decimal-point rules, and optional parameters for M30. Review the control comparison table above and verify the exact syntax in your machine’s programming manual before proving out the program.
Sources
The meaning of this code agrees in two or more sources from different publishers. Explanations are written in our own words.
- Mitsubishi Electric — The Basics of CNC Machining Programming (for Machining center) e-Learning material (PDF) mitsubishielectric.com
- Mitsubishi Electric — The Basics of CNC Machining Programming (for Lathe) e-Learning material (PDF, BNP-C8027-688) mitsubishielectric.com
- Siemens AG — SINUMERIK 802D sl/840D/840D sl/840Di/840Di sl/810D Programming Manual ISO Milling, 04.2007 Edition (6FC5398-7BP10-0BA0) cache.industry.siemens.com
- Haas Automation, Inc. — Mill Operator's Manual – 18 Mill M-Codes (online version) haascnc.com
- Haas Automation, Inc. — Lathe Operator's Manual – 17 Lathe M-Codes (online version) haascnc.com
- National Institute of Standards and Technology (NIST), USA — The NIST RS274NGC Interpreter – Version 3 (NISTIR 6556, 2000) nvlpubs.nist.gov
- Saitama University, Faculty of Engineering, Department of Mechanical Engineering, practical training — Machining center program 2019 (training NC program O19-0101, with comments) jisshu.mech.saitama-u.ac.jp