Introduction to G Codes and M Codes
Fanuc M-Code G-Code, G codes (preparatory commands) and M codes (auxiliary commands) are essential instructions used to control machine tools.
- G codes govern motion, positioning, and machining operations (e.g., linear interpolation, circular movements, tool compensation).
- M codes manage auxiliary functions (e.g., spindle control, coolant activation, tool changes).
These Fanuc M-Code G-Code vary slightly depending on the machine type (lathe, mill, etc.) and Fanuc control version. Always consult your machine’s manual for specifics.
Common Fanuc G Codes
Machining Centers
| Code | Description |
|---|---|
| G00 | Rapid positioning (fast traverse) |
| G01 | Linear interpolation (straight-line motion) |
| G02 | Circular interpolation (clockwise) |
| G03 | Circular interpolation (counterclockwise) |
| G04 | Dwell (pause) |
| G05 | non standard g-code |
| G17 | XY plane selection |
| G18 | XZ plane selection |
| G19 | YZ plane selection |
| G20 | Programming in inches |
| G21 | Programming in millimeters |
| G22 | |
| G28 | Return to reference position (home) |
| G29 | Return from reference point |
| G30 | Return to secondary reference position |
| G40 | Cancel tool radius compensation |
| G41 | Tool radius compensation left |
| G42 | Tool radius compensation right |
| G43 | Tool length compensation (positive) |
| G44 | Tool length compensation (negative) |
| G49 | Cancel tool length compensation |
| G54–G59 | Work coordinate system (WCS) selection |
| G61 | Exact stop check (precision mode) |
| G90 | Absolute programming |
| G91 | Incremental programming |
| G92 | Set position by programming |
| G94 | Per-minute feedrate mode |
| G95 | Per-revolution feedrate mode |
| G100–G199 | Macro programs (varies by configuration) |
LATHES
Some G codes are not avialable depending on kind of CNC
| Code | Description |
|---|---|
| G00 | Rapid positioning (fast traverse) |
| G01 | Linear interpolation (straight-line motion) |
| G02 | Circular interpolation (clockwise) |
| G03 | Circular interpolation (counterclockwise) |
| G04 | Dwell (pause) |
| G05 | High-speed cycle machining |
| G09 | Exact stop |
| G10 | Data setting |
| G11 | Data setting mode cancel |
| G15 | Polar coordinates command cancel |
| G16 | Polar coordinates command |
| G17 | XY plane selection |
| G18 | XZ plane selection |
| G19 | YZ plane selection |
| G20 | Programming in inches |
| G21 | Programming in millimeters |
| G22 | Stored stroke check function on |
| G23 | Stored stroke check function off |
| G27 | Reference point return check |
| G28 | Return to reference position (home) |
| G29 | Return from reference position |
| G30 | Return to secondary reference position |
| G31 | Skip fonction |
| G33 | Treading |
| G39 | Corner offset circular interpolation |
| G40 | Cancel tool radius compensation |
| G41 | Tool radius compensation left |
| G42 | Tool radius compensation right |
| G43 | Tool length compensation (positive) |
| G44 | Tool length compensation (negative) |
| G45 | Tool offset extension |
| G46 | Tool offset reduction |
| G47 | Double extension of tool offset |
| G48 | Tool offset reduction by half |
| G49 | Cancel tool length compensation |
| G50 | Scaling cancel |
| G51 | Scaling |
| G52 | Local coordinate system setting |
| G53 | selection of machine coordinate system |
| G54–G59 | Work coordinate system (WCS) selection |
| G60 | Unidirectional positioning |
| G61 | Exact stop check (precision mode) |
| G62 | automatic corner override |
| G63 | Tapping mode |
| G64 | Cutting mode |
| G65 | Macrocommand, macro call |
| G66 | Custom macro modal call |
| G67 | Custom macro modal call cancel |
| G68 | Coordinate rotation |
| G69 | Coordinate rotation cancel |
| G70 | Finish cycle |
| G71 | Rough cutting cycle of outer diameter |
| G72 | Rough cutting cycle end face |
| G73 | Peck drilling cycle |
| G74 | Counter tapping cycle |
| G75 | Outer inner diameter cutting off cycle |
| G76 | multiple threading cycle |
| G80 | Canned cycle cancel |
| G81 | Drilling cycle, spot boring |
| G82 | Drilling cycle, counter boring |
| G83 | Peck drilling cycle |
| G84 | Tapping cycle |
| G85 | Boring cycle |
| G86 | Boring cycle |
| G87 | Back boring cycle |
| G88 | Boring cycle |
| G89 | Boring cycle |
| G90 | Absolute programming |
| G91 | Incremental programming |
| G92 | Set coordinate system by programming |
| G94 | Per-minute feedrate mode |
| G95 | Per-revolution feedrate mode |
| G96 | Constant surface speed control |
| G97 | Constant surface speed control cancel |
| G98 | Return to initial point |
| G99 | Return to R point |
| G100–G199 | Macro programs (varies by configuration) |
Common Fanuc M Codes
lathe
| Code | Description |
|---|---|
| M00 | Program stop |
| M01 | Optional stop |
| M02 | Program end |
| M03 | Spindle on (clockwise) |
| M04 | Spindle on (counterclockwise) |
| M05 | Spindle stop |
| M06 | Tool change |
| M07 | Mist coolant on (air cooling) |
| M08 | Flood coolant on |
| M09 | Cooling (air cooling, water cooling, central outlet) OFF |
| M10 | Chuck CLAMP |
| M11 | Chuck UNCLAMP |
| M12 | QUILL OUT |
| M13 | QUILL IN / 4th axls clamp |
| M14 | 4th axls unclamp |
| M15 | 5th axls clamp |
| M16 | 5th axls unclamp |
| M17 | AUTO DOOR CLOSE |
| M18 | AUTO DOOR OPEN |
| M19 | Spindle orientation |
| M20 | Open tool magazine door |
| M21 | Close tool magazine door |
| M23 | CHAMFERING ON / Main shaft center water opening |
| M24 | CHAMFERING OFF / Main shaft center water outlet is closed |
| M25 | LNS BAR FEEDER EXTEND |
| M26 | BAR FEEDER ON |
| M27 | BAR FEEDER OFF |
| M28 | PART CATCHER EXTEND / Enable external data input |
| M29 | PART CATCHER RETRACT / Disable external data input |
| M30 | Program end and return to start |
| M31 | CHUCK BYPASS ON |
| M32 | CHUCK BYPASS OFF |
| M37 | CHIP CONVEYOR CW |
| M38 | CHIP CONVEYOR STOP |
| M43 | SETTER DOWN |
| M44 | SETTER UP |
| M47 | SOFT LIMIT 2 VALID |
| M48 | SOFT LIMIT 3 VALID |
| M49 | SOFT LIMIT 2/3 UNVALID |
| M41–M49 | Tool changer preparation |
| M51 | ERROR DETECT OFF |
| M52 | ERROR DETECT ON |
| M53 | STEADY CLAMP |
| M54 | STEADY UNCLAMP |
| M55 | TAIL STOCK CLAMP |
| M56 | TAIL STOCK UNCLAMP |
| M61–M69 | Tool selection (machine-specific) |
| M79 | Tool reset (suitable for arm type tool store) |
| M97 | PARTS COUNTED |
| M98 | Subprogram call |
| M99 | Subprogram return |
| M100–M199 | Customizable codes (user-defined) |
Mori Seiki
ZL-15S, ZL-15SM, ZL-15SMC
Contrôleur : FS-OTTB
| M CODE | FUNCTION |
| M00 | PROGRAM STOP |
| M01 | OPTIONAL STOP |
| M02 | END OF PROGRAM |
| M03 | NORMAL SPINDLE ROTATION |
| M04 | REVERSE SPINDLE ROTATION |
| M05 | SPINDLE STOP |
| M08 | COOLANT PUMP ON |
| M09 | COOLANT PUMP OFF |
| M10 | CHUCK CLAMP |
| M11 | CHUCK UNCLAMP |
| M13 | NORMAL MILLING ROTATION |
| M14 | REVERSE MILLING ROTATION |
| M17 | NORMAL TURRET ROTATION |
| M18 | REVERSE TURRET ROTATION |
| M19 | SPINDLE ORIENTATION |
| M20 | SPINDLE ORIENTATION CANCEL |
| M23 | CHAMFERING ON |
| M24 | CHAMFERING OFF |
| M28 | IN-POSITION CHECK ON |
| M29 | IN-POSITION CHECK OFF |
| M30 | RESET & REWIND |
| M31 | INTERLOCK BY-PASS ON |
| M32 | INTERLOCK BY-PASS OFF |
| M35 | SYNCHRONOUS OPERATION ON |
| M36 | SYNCHRONOUS OPERATION OFF |
| M45 | C-AXIS CONNECTION ON |
| M46 | C-AXIS CONNECTION OFF |
| M48 | OVERRIDE CANCEL ON |
| M49 | OVERRIDE CANCEL OFF |
| M51 | AIR BLOW ON |
| M52 | SPINDLE AIR BLOW 2 ON |
| M53 | SENSOR AIR BLOW ON |
| M57 | SPINDLE AIR BLOW 2 OFF |
| M58 | SENSOR AIR BLOW OFF |
| M59 | AIR BLOW OFF |
| M60 | EXTERNAL M-CODE OUTPUT |
| M61 | EXTERNAL M-CODE OUTPUT |
| M62 | EXTERNAL M-CODE OUTPUT |
| M63 | EXTERNAL M-CODE OUTPUT |
| M64 | EXTERNAL M-CODE OUTPUT |
| M65 | EXTERNAL M-CODE OUTPUT |
| M66 | EXTERNAL M-CODE OUTPUT |
| M67 | EXTERNAL M-CODE OUTPUT |
| M68 | SPINDLE BRAKE CLAMP |
| M69 | SPINDLE BRAKE UNCLAMP |
| M70 | BAR FEEDER OUT |
| M71 | PRESETTER UP |
| M72 | PRESETTER DOWN |
| M73 | PARTS CATCHER OUT |
| M74 | PARTS CATCHER IN |
| M75 | X-AXIS MIRROR IMAGE OFF |
| M76 | X-AXIS MIRROR IMAGE ON |
| M77 | WORK CHUCKING DETECTION |
| M80 | CUTTING-OFF DETECTION |
| M81 | HIGH PRESSURE BRAKE ON |
| M83 | 2-STEP CLAMPING PRESSURE SYSTEM FOR CHUCK OFF |
| M84 | 2-STEP CLAMPING PRESSURE SYSTEM FOR CHUCK ON |
| M85 | AUTO DOOR OPEN |
| M86 | AUTO DOOR CLOSE |
| M87 | AIR-BLOW 2 ON |
| M88 | AIR-BLOW 2 OFF |
| M89 | WORK-COUNTER |
| M90 | SPINDLE/ROTARY TOOL SIMULTANEOUS OPERATION ON |
| M91 | SPINDLE/ROTARY TOOL SIMULTANEOUS OPERATION OFF |
Dual-spindle CNC lathe
BIGLIA B.500/SM
| M-Code | Function | Description |
| M00 | PROGRAM STOP | Unconditional program stop. Spindle, feed axes and coolant are switched off. Cycle is resumed by pressing CYCLE START at the operator panel. Used for part reversal, manual gauging, or intermediate inspection steps during the machining cycle. |
| M01 | OPTIONAL STOP | Conditional stop active only when the “Optional Stop” switch on the operator panel is set to ON. Allows quality-check breakpoints to be inserted without modifying the part program. Widely used between tool changes during setup and first-off inspection. |
| M02 | END OF PROGRAM (no rewind) | Ends the program and stops all active functions (spindle, coolant, feed). Unlike M30, the program cursor does not automatically return to the beginning of the program. Rarely used on the BIGLIA B.500/SM where M30 is the standard end-of-program code. |
| M30 | END OF PROGRAM + REWIND | End of program: stops spindle, feed axes and coolant, then automatically rewinds the program pointer to the start. Standard end-of-program code on the BIGLIA B.500/SM. Enables automatic cycle repeat in production mode. |
| M98 | SUBPROGRAM CALL | Calls a subprogram stored in CNC memory: M98 Pxxxx (program number). The control executes the subprogram and returns to the next block of the main program. With address L: M98 Pxxxx Lnn repeats the subprogram nn times. Used for repetitive machining patterns. |
| M99 | END OF SUBPROGRAM / LOOP | Ends a subprogram and returns to the calling program at the block following M98. Without argument: normal return. With Pxxxx: jumps to a specific sequence number. When used in a main program without a calling M98, creates an infinite program loop. |
| M03 | SPINDLE ROTATION CLOCKWISE (CW) | Starts the main spindle in the clockwise direction (viewed from the spindle face / chuck side). Always programmed with an S-word (speed): e.g. G96 S180 M03 (constant surface speed) or G97 S800 M03 (fixed RPM). Must be preceded by G50 Sxxx to set maximum spindle speed. Most frequently used code in production programs. |
| M04 | SPINDLE ROTATION COUNTER-CLOCKWISE (CCW) | Starts the main spindle in the counter-clockwise direction. Used on the BIGLIA B.500/SM for second-operation machining after part transfer, left-hand threading, parting-off, and specific left-hand profiling operations. |
| M05 | SPINDLE STOP | Stops the main spindle rotation. The stop is confirmed when spindle speed reaches zero and the completion signal is sent to the CNC. Always followed by M09 (coolant off). Programmed before every tool change and at end of program. |
| M13 | CW SPINDLE + COOLANT ON (Combined M03 + M08) | Combined command activating clockwise spindle rotation (M03) and coolant (M08) simultaneously in a single block. Simplifies programming by reducing the number of NC blocks. Available depending on the machine PMC configuration. |
| M14 | CCW SPINDLE + COOLANT ON (Combined M04 + M08) | Combined command activating counter-clockwise spindle rotation (M04) and coolant (M08) simultaneously. Equivalent of M13 for the reverse direction. Available depending on PMC configuration. |
| M19 | SPINDLE ORIENTATION (Oriented Stop) | Positions and locks the spindle at a defined angular position (default 0°, adjustable by parameter). Requires a spindle encoder and the Spindle Orientation option. Used prior to specific tool change sequences or angular part re-registration operations. |
| M62 | SPINDLE OUTPUT ENABLE | Validates the main spindle drive command output. A machine-specific function defined in the machine PMC for particular operating modes. Appears once in the analyzed programs for a special spindle control sequence. |
| M40 | GEAR CHANGE NEUTRAL | Places the gearbox in neutral (no gear engaged). On machines equipped with a mechanical multi-speed gearbox, gear range selection is triggered automatically via the programmed speed range parameters or manually by M40–M43. Must always be executed with spindle stopped (M05). |
| M41 | GEAR CHANGE LOW RANGE | Engages the low speed gear range on the BIGLIA B.500/SM gearbox. Low range: maximum torque, lowest speeds suited to heavy roughing passes on hard materials (stainless steel, cast iron). Spindle must be stopped (M05) before any gear change. |
| M42 | GEAR CHANGE MIDDLE RANGE | Engages the intermediate gear range. Most frequently used range for general turning operations on steel, aluminium and brass at moderate spindle speeds. Always programmed before G96 Sxxx M03 (e.g. M42 then G96 S180 M03). Spindle must be stopped before gear change. |
| M43 | GEAR CHANGE HIGH RANGE | Engages the high speed gear range: high spindle speeds, reduced torque. Used for finishing passes, aluminium, brass and plastics requiring high cutting speeds. Allows the BIGLIA B.500/SM to reach its maximum spindle speed. Spindle must be stopped before engaging. |
| M07 | COOLANT ON CIRCUIT 1 (High pressure / mist) | Activates the primary coolant circuit (high-pressure external coolant). The most frequently used coolant code. Typically inserted within a feed move block (e.g. G1 X-1.6 F0.1 M07) to start coolant delivery simultaneously with the cutting pass. |
| M08 | COOLANT ON CIRCUIT 2 (Flood / supplementary) | Activates the secondary coolant circuit (flood coolant or supplementary nozzle), depending on the machine hydraulic configuration. Used for deep drilling and threading operations requiring sustained chip evacuation and heat dissipation. |
| M09 | ALL COOLANT OFF | Simultaneously shuts off all active coolant circuits (M07, M08, and mist lubrication if active). Programmed at the end of every cutting cycle, before each tool change, and typically embedded in the tool retract block (e.g. G0 X200. Z200. M09). |
| M28 | SLIDEWAY LUBRICATION (Pulse) | Commands a single lubrication pulse to the machine guideways (X and Z linear guides) and ballscrews. This function is typically managed automatically by a timed PMC routine and is rarely programmed explicitly in part programs. |
| M24 | MAIN CHUCK / COLLET OPEN | Commands the hydraulic opening (unclamping) of the main spindle chuck or collet. Activated at end of program for part ejection or during part reversal sequences. On the BIGLIA B.500/SM, triggered by the PMC actuating the hydraulic clamping valve. |
| M25 | MAIN CHUCK / COLLET CLOSE | Commands the hydraulic clamping of the main spindle chuck or collet. Clamping is confirmed by the pressure sensor signal before the cycle continues. Used after part positioning or during spindle synchronisation sequences. Program comment: (M.P. CHIUSO = Main Chuck Closed). |
| M64 | SELECT MAIN SPINDLE (Chuck control mode) | Selects the main spindle as the active spindle for chuck/collet clamping and unclamping commands. On the BIGLIA B.500/SM dual-spindle configuration, this switches control between the main chuck and the sub-spindle chuck. Program comment: (SEL MAN PR = Main Spindle Selected). |
| M68 | CLAMP MAIN COLLET / CHUCK | Commands clamping of the main spindle collet or chuck (pneumatic or hydraulic depending on machine specification). One of the most frequently used auxiliary codes. Paired with M69 for unclamp. Commonly used with bar feeders in automatic bar-feed production mode. |
| M69 | UNCLAMP MAIN COLLET / CHUCK | Commands unclamping of the main spindle collet or chuck. Programmed at the start of the cycle (before G28 U0) to release the collet prior to bar feed advancement, or at end of program for finished part discharge. |
| M21 | TAILSTOCK ADVANCE | Commands the tailstock to advance toward the workpiece. The tailstock moves hydraulically to an adjustable mechanical stop. Travel stops on force detection or at the end-of-travel limit switch. Used to support long workpieces in between-centres turning operations. |
| M22 | TAILSTOCK RETRACT | Commands the tailstock to retract to its rest position, releasing the workpiece from the live/dead centre. Retract position is confirmed by a home position sensor before the program continues. |
| M46 | TAILSTOCK BODY UNLOCK + QUILL ADVANCE | Unlocks the tailstock body on the guideways and simultaneously advances the quill (tailstock barrel). Allows the tailstock to be repositioned freely along the bed. Specific to machines with CNC-programmable tailstock positioning. |
| M47 | TAILSTOCK BODY CLAMP + QUILL RETRACT | Clamps the tailstock body in position on the guideways and simultaneously retracts the quill. Complement of M46. Ensures the tailstock is rigidly locked before between-centres machining or collet clamping sequences. |
| M53 | TAILSTOCK BRAKE RELEASE (Free travel) | Releases the hydraulic tailstock clamp brake to allow free positioning travel. Program comment: (CONTR. APERTA = Tailstock Open). Defined in the machine PMC. Always followed by a travel move and then M54 (clamp) or M78 (rapid advance). |
| M54 | TAILSTOCK HYDRAULIC CLAMP | Hydraulically clamps the tailstock in its current position. Program comment: (CONTR. CHIUSA = Tailstock Clamped). Confirms secure tailstock contact with the workpiece before machining. Clamping pressure is programmable in the machine PMC parameters. |
| M78 | TAILSTOCK RAPID ADVANCE (Approach) | Commands the tailstock rapid approach toward the workpiece. Triggers the hydraulic or servo-driven advance in fast approach mode. Always followed by a controlled G01 move for precision positioning and then M79 (centre locking under pressure). |
| M79 | TAILSTOCK CENTRE LOCK (Controlled thrust) | Locks the tailstock with a controlled hydraulic thrust force against the workpiece centre. Thrust force is an adjustable parameter. Used for between-centres turning operations or during workpiece transfer to the sub-spindle. |
| M58 | SUB-SPINDLE ENABLE | Enables the sub-spindle (secondary spindle at the tailstock end). On the BIGLIA B.500/SM dual-spindle configuration, activates the secondary spindle drive for second-operation machining without part removal. Always paired with M03 or M04 to set the direction of rotation. |
| M59 | SUB-SPINDLE DISABLE | Stops and disables the sub-spindle. Programmed at the end of second-operation machining sequences, before tool retract and program end. Always used in symmetry with M58 in dual-operation programs. |
| M63 | SECONDARY SPINDLE STOP (Combined) | Stops the secondary spindle (sub-spindle). Used in combined sequences (M05 M63) to simultaneously stop both the main spindle and the sub-spindle after workpiece transfer. Defined in the machine PMC. |
| M65 | SUB-SPINDLE ACTIVATE (Controtesta mode) | Activates the motorised sub-spindle (controtesta). Program comment: (CONTROTESTA). After M65, the CNC selects the tool offsets and machining parameters associated with the sub-spindle for second-operation turning. Paired with M64 for spindle selection. |
| M85 | SUB-SPINDLE PART EJECTOR ADVANCE | Commands the advance of the part ejector/pusher on the sub-spindle. After second-operation machining is complete, ejects the finished part onto the conveyor or parts catcher. Activated via the machine PMC. Not active in manual production mode without a bar loader. |
| M86 | SUB-SPINDLE PART EJECTOR RETRACT | Retracts the sub-spindle part ejector to its rest position after part ejection. Complement of M85. Retract position is confirmed by the end-of-travel sensor before the next cycle begins. |
| M61 | MAIN / SUB-SPINDLE SYNCHRONISATION | Initiates angular synchronisation between the main spindle and the sub-spindle for shock-free workpiece transfer. Synchronisation is managed by the machine PMC. Must always be executed before M53 (tailstock travel) and M54 (tailstock clamp) in the transfer sequence. |
| M115 | SPINDLE / B-AXIS COUPLING (Special angular sync) | BIGLIA-specific function: activates synchronised coupling between the main spindle and the B-axis (or C-axis depending on machine configuration). Program comment: (C.SP.ASSE B). Used in transfer sequences requiring precise angular alignment between the two spindles. |
| M10 | C-AXIS ENABLE (Spindle indexing mode) | Enables the C-axis: the main spindle switches from continuous rotation mode to a servo-controlled positioning axis. Required before any live-tool milling or off-centre drilling operation. Always followed by G28 C0 (C-axis reference return) before the first angular positioning move. |
| M11 | C-AXIS DISABLE | Disables the C-axis and releases the spindle back to free rotation mode for turning operations. Programmed at the end of live-tool sequences, before returning to standard turning with M03/M04. |
| M70 | RADIAL LIVE TOOL ENABLE | Enables the radial live-tool head (tooling operating perpendicular to the Z-axis). Activates the radial powered tool station for radial drilling and milling operations (cross holes, flats, hexagons). Must be preceded by M10 (C-axis enable). Defined in the machine PMC. |
| M71 | RADIAL LIVE TOOL DISABLE | Disables the radial live-tool head and returns the turret to standard turning mode. Programmed after radial live-tool operations, before M11 (C-axis disable) and return to turning. |
| M73 | LIVE TOOL ROTATION CLOCKWISE (CW) | Starts the live tool spindle (milling cutter, drill) in the clockwise direction. Equivalent of M03 for the turret live-tool motor. Used in all axial and radial live-tool cycles (e.g. G97 S2000 M73 for milling at 2000 RPM). Defined in the machine PMC. |
| M74 | LIVE TOOL ROTATION COUNTER-CLOCKWISE (CCW) | Starts the live tool spindle in the counter-clockwise direction. Used for left-hand tapping or climb milling with specific tools. Complement of M73. Defined in the machine PMC. |
| M75 | LIVE TOOL STOP | Stops the live tool spindle. Equivalent of M05 for the turret live-tool motor. Programmed after live-tool operations before the rapid retract move (e.g. G0 X200. Z50. M75). Defined in the machine PMC. |
| M29 | RIGID TAPPING ENABLE | Activates the rigid tapping mode: the spindle rotation is electronically synchronised with the Z-axis feed through the G84 tapping cycle, eliminating the need for a floating tap holder. Requires the Rigid Tapping option and a spindle encoder. Syntax: M29 S[speed] then G84 Z_ R_ F[pitch]. |
| M35 | SYNCHRONISED TAPPING ENABLE (Machine PMC) | Activates the synchronised tapping mode via the machine PMC. Validates internal spindle speed control for the tapping cycle. Present in the analyzed programs. This is a machine-specific PMC function, not a standard CNC code. |
| M48 | FEEDRATE / SPINDLE OVERRIDE ENABLE | Re-enables the manual feedrate and spindle speed override controls from the operator panel. Used at the end of threading or tapping cycles (where overrides were locked by M49) to restore operator speed control. |
| M49 | FEEDRATE / SPINDLE OVERRIDE INHIBIT | Disables manual feedrate and spindle override adjustments from the operator panel. Mandatory during threading cycles (G32, G76, G92) and rigid tapping to maintain the precise speed-to-feed ratio. Cancelled by M48 at the end of the cycle. |
| M38 | STEADY REST CLAMP | Commands closure of the fixed steady rest (steady rest fingers) onto the workpiece. Available on configurations fitted with a hydraulic steady rest for supporting long workpieces during turning. The steady rest must be pre-set to the workpiece diameter before clamping. |
| M39 | STEADY REST UNCLAMP | Commands opening of the fixed steady rest, releasing the workpiece support. Unclamp is confirmed by a position sensor before any workpiece movement. Complement of M38. |
| M50 | BAR FEEDER ADVANCE (Bar loader) | Commands the bar feeder to advance a new bar into the chuck/collet after part cut-off and ejection. Triggers the bar feed advance cycle. Not active in manual production mode without a bar loader connected to the machine. |
| M52 | FRONT GUARD DOOR OPEN | Commands opening of the front protection door (splash guard / electric sliding door). Activates the door actuator (pneumatic cylinder or gearmotor). Used in automatic load/unload sequences or after M00 stops for part inspection. |
| M06 | AUTOMATIC TOOL CHANGE (Turret index) | Commands automatic indexing of the turret to the tool station designated by the T-word. On the BIGLIA B.500/SM, tool changes are typically integrated into the T-command (e.g. T0303 = tool station 3, offset 3). M06 may or may not be required depending on the machine PMC configuration. |
| M17 | TURRET INDEX FORWARD DIRECTION | Forces turret indexing in the forward (positive) direction to reach the requested tool station. On machines with bi-directional turrets, overrides the automatic shortest-path selection. Normally managed automatically by the T-command. |
| M18 | TURRET INDEX REVERSE DIRECTION | Forces turret indexing in the reverse direction to reach the requested tool station. Allows the shortest path to be forced in reverse when needed. Normally managed automatically by the T-command shortest-path algorithm. |
| M80 | CYCLE END REQUEST PART UNLOAD (Bar loader interface) | End-of-cycle signal sent to the automatic bar loader or robot: requests finished part ejection and loading of the next bar/blank. Interface between the CNC and the bar feeder or loading robot. Not active in manual production mode. |
| M81 | PART RELEASED (Bar loader interface) | Confirms to the bar loader or robot that the finished part has been released (chuck open, part accessible for pick-up). Synchronises the CNC with the loader for automatic part exchange in production cycle. |
| M82 | REQUEST PART LOAD (Bar loader interface) | Signal to the bar loader to insert a new raw part or bar stock into the chuck. The CNC waits for the M83 confirmation signal (part clamped) before resuming the machining cycle. |
| M83 | PART CLAMPED CONFIRMED (Bar loader interface) | Confirmation from the bar loader that the new workpiece is correctly clamped in the chuck. Reply signal to M82. The part program resumes machining after receipt of this confirmation signal. |
| M90 | PARTS COUNTER INCREMENT + PARTIAL RESET | Increments the finished-parts counter on the operator panel and/or performs a partial reset of internal machine states. Programmed at the end of certain programs before M30. On some PMC configurations, also controls the chip conveyor or resets axis-specific states. |
Technical Notes
- Dual-Spindle Architecture : The BIGLIA B.500/SM is a CNC dual-spindle turning center with a main spindle and a motorised sub-spindle . The main spindle handles first-operation machining; the sub-spindle enables complete second-operation machining without unloading the part. Part transfer between spindles is achieved through spindle angular synchronisation (M61/M115) and tailstock clamping sequences.
- Machine PMC Codes : All M-codes above M20 (except M28, M29, M30, M48, M49, M98, M99) are machine auxiliary functions defined by BIGLIA in the PLC Ladder program (PMC). Their exact behaviour depends on the PMC software version and the options fitted to the machine. Always refer to the BIGLIA B.500/SM electrical manual and the PMC program listing for authoritative code definitions.
- Spindle Gear Ranges : The BIGLIA B.500/SM is fitted with a mechanical multi-speed gearbox driven by pneumatic actuators. Gear range selection (M41/M42/M43) must always be executed with the spindle stopped (M05). The spindle speed parameters for each range are defined in the machine CNC parameters. On 2-range configurations, M42 may represent the high range.
- C-Axis / Live Tooling : The C-axis and live-tool functions (M10/M11, M70–M75) require the C-axis option to be installed and configured on the CNC. Before any live-tool operation, the C-axis must be enabled (M10), a C-axis reference return performed (G28 C0), and the appropriate live-tool station enabled (M70 for radial, or direct for axial). Always disable the live-tool motor (M75) and C-axis (M11) before returning to turning mode.
- Bar Feeder Interface:M50, M80–M83 are active only when the machine is connected to an automatic bar feeder or loading robot. In manual production mode, these codes are either ignored or suppressed by a PMC parameter. Including them in a program intended for manual operation may cause the CNC to wait indefinitely for a confirmation signal.
DAEWOO PUMA 450
| M-CODE | DESCRIPTION |
| M00 | PROGRAM STOP |
| M01 | OPTIONAL STOP |
| M02 | PROGRAM END |
| M03 | MAIN-SPINDLE FORWARD |
| M04 | MAIN-SPINDLE REVERSE |
| M05 | MAIN-SPINDLE STOP |
| M07 | HIGH PRESSURE COOLANT ON |
| M08 | COOLANT ON |
| M09 | COOLANT OFF |
| M10 | PARTS CATCHER ADVANCE |
| M11 | PARTS CATCHER RETRACT |
| M13 | TURRET AIR BLOW |
| M14 | MAIN-SPINDLE AIR BLOW |
| M15 | AIR BLOW OFF |
| M17 | MACHINE LOCK ACT |
| M18 | MACHINE LOCK CANCEL |
| M19 | MAIN-SPINDLE ORIENTAION |
| M24 | CHIP CONVEYOR RUN |
| M25 | CHIP CONVEYOR STOP |
| M30 | PROGRAM END & REWIND |
| M31 | INTERLOCK BY-PASS(SPDL &T/S) |
| M32 | INTERLOCK BY-PASS(SPDL &S/R) |
| M33 | REV.-TOOL-SPINDLE FORWARD |
| M34 | REV.-TOOL-SPINDLE REVERSE |
| M35 | REV.-TOOL-SPINDLE STOP |
| M39 | STEADY REST 1 UNCLAMP |
| M40 | GEAR CHANGE NETURAL |
| M41 | GEAR CHANGE LOW |
| M42 | GEAR CHANGE MIDDLE |
| M43 | GEAR CHANGE HIGH |
| M46 | PTS BODY UNCL & TRACT-BAR ADV. |
| M47 | PTS BODY CL & TRACT-BAR RET. |
| M50 | BAR FEEDER COMMAND 1 |
| M51 | BAR FEEDER COMMAND 2 |
| M52 | SPLASH GUARD DOOR OPEN |
| M53 | SPLASH GUARD DOOR CLOSE |
| M54 | PARTS COUNT |
| M58 | STEADY REST 2 CLAMP |
| M59 | STEADY REST 2 UNCLAMP |
| M61 | SWITCHING LOW SPEED (N.J) |
| M62 | SWITCHING HIGH SPEED (N.J) |
| M63 | MAIN-SPDL CW & COOLANT ON |
| M64 | MAIN-SPDL CCW & COOLANT OFF |
| M65 | MAIN-SPDL & COOLANT OFF |
| M66 | DUAL CHUCKING LOW CLAMP |
| M67 | DUAL CHUCK HIGH CLAMP |
| M68 | MAIN-CHUCK CLAMP |
| M69 | MAIN-CHUCK UNCLAMP |
| M70 | DUAL TAILSTOCK LOW ADVANCE |
| M74 | ERROR DETECT ON |
| M75 | ERR0R DETECT OFF |
| M76 | CLAMFERING ON |
| M77 | CLAMFERING OFF |
| M78 | TAILSTOCK QUILL ADVANCE |
| M79 | TAILSTOCK QUILL RETRACT |
| M80 | Q-SETTER SWING ARM DOWN |
| M81 | Q-SETTER SWING ARM UP |
| M84 | TURRET CW ROTATION |
| M85 | TURRET CCW ROTATION |
| M86 | TORQUE SKIP ACT |
| M87 | TORQUE SKIP CANCEL |
| M88 | SPINDLE LOW CLAMP |
| M89 | SPINDLE HIGH CLAMP |
| M90 | SPINDLE UNCLAMP |
| M91 | EXTERNAL M91 COMMAND |
| M92 | EXTERNAL M92 COMMAND |
| M93 | EXTERNAL M93 COMMAND |
| M94 | EXTERNAL M94 COMMAND |
| M98 | SUB-PROGRAM CALL |
| M99 | END OF SUB-PROGRAM |
| M103 | SUB-SPINDLE FORWARD |
| M104 | SUB-SPINDLE REVERSE |
| M105 | SUB-SPINDLE STOP |
| M110 | PARTS CATCHER ADVANCE(SUB) |
| M111 | PARTS CATCHER RETRACT(SUB) |
| M114 | SUB-SPINDLE AIR BLOW |
| M119 | SUB-SPINDLE ORIENTATION |
| M131 | INTERLOCK BY-PASS (SUB-SPDL) |
| M163 | SUB-SPDL CW & COOLANT ON |
| M164 | SUB-SPDL CCW & COOLANT OFF |
| M165 | SUB-SPDL & COOLANT STOP |
| M168 | SUB-CHUCK CLAMP |
| M169 | SUB-CHUCK UNCLAMP |
| M203 | FORWARD SYNCHRONOUS COM. |
| M204 | REVERSE SYNCHRONOUS COM. |
| M205 | SYNCHRONOUS STOP |
| M206 | SPINDLE ROTATION RELEASE |
Machining Centers
AWEA
AF 650
TYPE:C-Type Series
CONTROLLER:FANUC 0iMD / 18iMB / 31iB
| M code | Function |
| M00 | Program Stop |
| M01 | Optional Stop |
| M02 | End of Program |
| M03 | Spindle Forward |
| M04 | Spindle Reverse |
| M05 | Spindle Stop |
| M06 | Automatic Tool Change |
| M07 | Air Blow ON |
| M08 | Coolant ON |
| M09 | All Coolant OFF (Cancel M07, M08, M28, M51) |
| M10 | 4th Axis Unclamp |
| M11 | 4th Axis Clamp |
| M13 | Spindle Forward – Flood Coolant ON |
| M14 | Spindle Reverse – Flood Coolant ON |
| M15 | ATC Door Open |
| M16 | ATC Door Close |
| M19 | Spindle Orientation |
| M21 | Tool Pocket Down & Magazine Move in |
| M23 | Spindle Unclamp |
| M25 | Spindle clamp |
| M27 | Arm Up & Magazine Move Out |
| M28 | Flood Coolant ON (OPTION) |
| M29 | Rigid Tapping Mode ON |
| M30 | End of Program |
| M39 | Retraction For Rigid Tapping |
| M45 | 5th Axis Unclamp |
| M46 | 5th Axis Clamp |
| M48 | Override Cancel On |
| M49 | Override Cancel Off |
| M51 | Coolant Through Spindle ON (OPTION) |
| M56 | ATLM & Air Clean ON |
| M57 | ATLM & Air Clean OFF |
| M59 | TS27R Start |
| M60 | OMP60 Start |
| M61 | Chip Wash Pump ON |
| M62 | Chip Conveyor ON |
| M63 | Chip Screw ON |
| M64 | Chip Remove System OFF |
| M65 | APC Clean ON |
| M66 | APC Clean OFF |
| M70 | Mirror Cancel |
| M71 | X Axis Mirror Effective |
| M72 | Y Axis Mirror Effective |
| M73 | Z Axis Mirror Effective |
| M74 | 4th Axis Mirror Effective |
| M75 | Counter OFF |
| M76 | Counter ON |
| M78 | APC Ready Check Finish |
| M79 | RECTIFICATION TOOL |
| M80 | APC Ready Check ON |
| M81 | Smoke Exhaust ON |
| M81 | Smoke Exhaust OFF |
| M85 | Oil Mist ON |
| M86 | Oil Mist OFF |
| M87 | Air Extraction ON |
| M88 | Air Extraction OFF |
| M98 | Call Sub-program |
| M99 | Return to Main Program |
LEADWELL
Machine : LV-300SL
Control : OMF | Option : 01/LO
CLASSIFICATION B = Basic / O = Option
| M | FUNCTION | DESCRIPTION | CL. |
| M00 | PROGRAM STOP | OPERATION CAN BE RESTART BY START BUTTON | B |
| M01 | OPTION STOP | ON/OFF OF M01 CONTROLLED BY SWITCH ON THE PANEL | B |
| M02 | PROGRAM END | NC UNIT IS RESET & STOPPING ALL OPERATIONS OF MACHINE | B |
| M03 | SPINDLE FORWARD | B | |
| M04 | SPINDLE REVERSE | B | |
| M05 | SPINDLE STOP | B | |
| M06 | AUTOMATIC TOOL CHANGE | O | |
| M07 | COOLANT THROUGH SPINDLE | B | |
| M08 | CUTTING OIL SUPPLY | SPINDLE MUST BE RUN ON AUTO MODE | B |
| M09 | CUTTING OIL STOP & OIL MIST OFF | B | |
| M13 | SPINDLE CW & COOLANT ON | B | |
| M14 | SPINDLE CCW & COOLANT ON | B | |
| M19 | SPINDLE ORIENTATION | B | |
| M23 | MAGAZINE POCKET UP | B | |
| M24 | MAGAZINE POCKET DOWN | B | |
| M25 | TOOL CLAMP | B | |
| M26 | TOOL UNCLAMP | B | |
| M29 | RIGID TAPPING | O | |
| M30 | PROGRAM REWIND | B | |
| M31 | PALLET UP | ONLY USED IN MDI MODE | B |
| M32 | PALLET DOWN | ONLY USED IN MDI MODE | B |
| M33 | PALLET CW | ONLY USED IN MDI MODE | B |
| M34 | PALLET CCW | ONLY USED IN MDI MODE | B |
| M40 | 4 AXIS CLAMP | FOR 4 MACHINE WITH 4TH AXIS SPARE FUNCTION FOR 3 AXIS | O |
| M41 | 4 AXIS UNCLAMP | SAME AS ABOVE | O |
| M45 | CHIP CONVEYOR ON | B | |
| M46 | CHIP CONVEYOR OFF | B | |
| M59 | AUTO PALLET CHANGE | B | |
| M61 | MIRROR IMAGE X OFF | B | |
| M62 | MIRROR IMAGE Y OFF | B | |
| M63 | MIRROR IMAGE 4 OFF | B | |
| M65 | MIRROR IMAGE 4 OFF | B | |
| M70 | MIRROR IMAGE X ON | B | |
| M71 | MIRROR IMAGE Y ON | B | |
| M74 | MIRROR IMAGE 4 ON | B | |
| M80 | ON/OFF MOMENTARY | O | |
| M81 | SPARE FUNCTION | M83:ON M84:OFF | O |
| M82 | SPARE FUNCTION | ON/OFF MOMENTARY | O |
| M83 | SPARE FUNCTION | M84:ON M83:OFF | O |
| M84 | SPARE FUNCTION | ON-FIN-OFF PULSE OUTPUT TYPE | O |
| M85 | SPARE FUNCTION | ON-FIN-OFF PULSE OUTPUT TYPE | O |
| M86 | SPARE FUNCTION | ON-FIN-OFF PULSE OUTPUT TYPE | O |
| M87 | SPARE FUNCTION | ON-FIN-OFF PULSE OUTPUT TYPE | O |
| M88 | SPARE FUNCTION | ON-FIN-OFF PULSE OUTPUT TYPE | O |
| M89 | SPARE FUNCTION | ON-FIN-OFF PULSE OUTPUT TYPE | O |
| M95 | PART COUNTER | B | |
| M98 | CALL SUB-PROGRAM | B | |
| M99 | END SUB-PROGRAM | B |
Daewoo
| Code | Description |
| M00 | Program stop |
| M01 | Optional stop |
| M02 | Program end |
| M03 | Spindle on (clockwise) |
| M04 | Spindle on (counterclockwise) |
| M05 | Spindle stop |
| M06 | Tool change |
| M07 | Mist coolant on (air cooling) |
| M08 | Flood coolant on |
| M09 | Cooling (air cooling, water cooling, central outlet) OFF |
| M14 | 4th axls unclamp |
| M15 | 5th axls clamp |
| M16 | 5th axls unclamp |
| M17 | AUTO DOOR CLOSE |
| M18 | AUTO DOOR OPEN |
| M19 | Spindle orientation |
| M20 | Open tool magazine door |
| M21 | Close tool magazine door |
| M30 | Program end and return to start |
| M37 | CHIP CONVEYOR CW |
| M38 | CHIP CONVEYOR STOP |
| M79 | Tool reset (suitable for arm type tool store) |
| M97 | PARTS COUNTED |
| M98 | Subprogram call |
| M99 | Subprogram return |
| M100–M199 | Customizable codes (user-defined) |
| M74 | TOUCH PROBE START |
| M75 | TOUCH PROBE STOP STATE |
| M76 | AUX. CLAMP 1 (FIXTURE DEVICE CLAMP 1) |
| M77 | AUX. UNCLAMP 1 (FIXTURE DEVICE UNCLAMP 1) |
| M78 | PALLET CLAMP |
| M79 | PALLET UNCLAMP |
| M80 | MIRROR IMAGE CANCEL |
| M81 | MIRROR IMAGE X AXIS |
| M82 | MIRROR IMAGE Y AXIS |
| M83 | MIRROR IMAGE 4th AXIS |
| M84 | CUTTING FEED POSSIBLE DURING SPINDLE STOP |
| M85 | CUTTING FEED IMPOSSIBLE DURING SPINDLE STOP |
| M86 | AUX. CLAMP 2 (FIXTURE DEVICE CLAMP 2) |
| M87 | AUX. UNCLAMP 2 (FIXTURE DEVICE UNCLAMP 2) |
| M88 | AUX. CLAMP 3 (FIXTURE DEVICE CLAMP 3) |
| M89 | AUX. UNCLAMP 3 (FIXTURE DEVICE UNCLAMP 3) |
| M90 | — |
| M91 | EXTERNAL M CODE 1 |
| M92 | EXTERNAL M CODE 2 |
| M93 | EXTERNAL M CODE 3 |
| M94 | EXTERNAL M CODE 4 |
| M95 | EXTERNAL M CODE 5 |
| M96 | MACRO INTERRUPT ENABLE |
| M97 | MACRO INTERRUPT CANCEL |
| M98 | SUBPROGRAM CALL |
| M99 | SUBPROGRAM END |
| M843 | RIGID TAPPING MODE (RIGHT-HAND THREAD) |
| M844 | RIGID TAPPING MODE (LEFT-HAND THREAD) |
| M845 | RIGID TAPPING MODE CANCEL |
Notes
- Variations: Codes may differ by machine manufacturer or Fanuc control version.
- Documentation: Always refer to your machine’s manual for exact code definitions.
- Compatibility: Codes depend on the machine type (e.g., lathe vs. mill).
For exhaustive lists of Fanuc M-Code G-Code, consult Fanuc technical manuals or your machine’s programming guide.




