Printed from Kezuriba (kezuriba.net/en/nc/m02/)
M02
Machining center, LatheProgram end
Format and notes
M02
- The NC is reset. What happens after the end (whether it rewinds to the start, etc.) depends on the machine builder
- Ending with M30 is the norm now
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.
Frequently asked questions about M02
- What is M02 (Program end) used for and how is it formatted in a CNC program?
- M02 commands "Program end" on Machining center, Lathe. The standard program format is "M02". The NC is reset. What happens after the end (whether it rewinds to the start, etc.) depends on the machine builder
- Is M02 a modal code or a one-shot (non-modal) code?
- Whether M02 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 M02 work differently on machining centers (mills) versus CNC lathes?
- M02 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 M02 across FANUC, Mitsubishi, Okuma, Haas, and Siemens controls?
- While the core behavior of M02 is shared across most ISO-compatible CNC controls (FANUC, Mitsubishi Electric, Haas), controls using native conversational or proprietary dialects (such as Okuma OSP, Siemens native mode, or Heidenhain) or machine-specific M-code tables may use different syntax. Always verify with single-block execution and distance-to-go display on a new machine.
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
- Ministry of Health, Labour and Welfare (MHLW), Human Resources Development Bureau, Office of the Councillor for Skills Evaluation — Human resource development manual using the practical exam tasks of the Grade 3 Skilled Worker Test: CNC lathe work (March 2018) waza.mhlw.go.jp