CNC MACHINISTTRAINING

FEATURE

M-Codes List for CNC Machine Programming

What Are M-Codes?

M-codes are also called miscellaneous functions. Unlike G-codes, which prepare a CNC machine to use a particular cycle or mode, M-codes command machine functions such as starting the spindle, switching coolant on, changing a tool, or ending a program.

M-code support varies among CNC machine manufacturers and controllers. Always confirm a code and its behavior in the programming manual for the specific machine before using it.

Common CNC M-Codes

CodeFunction
M00Compulsory program stop
M01Optional program stop
M02End of program without rewind, usually with reset
M03Start spindle clockwise for right-hand tools
M04Start spindle counterclockwise for right-hand tools
M05Stop spindle
M06Automatic tool change
M07Turn coolant mist on, when available
M08Turn coolant on
M09Turn coolant off
M19Orient spindle
M30End program, reset, and rewind
M48Deactivate feed-rate override cancellation
M49Activate feed-rate override cancellation
M60Automatic pallet change
M78Clamp B axis; nonstandard
M79Unclamp B axis; nonstandard
M98Call a subprogram
M99End or return from a subprogram

Programming Considerations

Many controllers permit only one M-code in a program block. Opposing commands such as M03 and M04 cannot be active together.

M98 can reduce repeated programming by calling a subprogram that performs the same operation multiple times. This can make a program shorter and easier to maintain and, depending on the application and controller, may help streamline the machining cycle.

The list above is not exhaustive. CNC machines often provide additional machine-specific miscellaneous functions. Consult the documentation for the individual milling or turning center to learn which codes are supported and how they behave.

0.0 out of 5Based on 0 ratings