M-Code
Machine function codes in CNC programming that control auxiliary operations including spindle on/off, coolant on/off, tool changes, pallet changes, and program stop. M-codes work in conjunction with G-codes to execute a complete machining sequence.
M-codes are auxiliary function commands in CNC programming that control machine-level operations like spindle on/off, spindle direction (clockwise or counterclockwise), coolant activation, tool changes, and program stop/pause functions. Common M-codes include M03 (spindle on clockwise), M05 (spindle off), M08 (coolant on), M09 (coolant off), and M06 (tool change), each serving a specific purpose in the machining sequence.
M-codes work in conjunction with G-codes to execute a complete machining program, G-codes command motion and cutting, while M-codes orchestrate spindle speed changes, tool swaps, and auxiliary functions. Modern CNC controllers can also respond to programmable M-codes (M100-M199 range) that trigger custom machine-specific functions, such as parts unloading systems or pallet changes on automated machines.
Proper sequencing of M-codes is critical for safety and efficiency; for example, the spindle must always be stopped (M05) before a tool change (M06), and coolant should be turned off before the part is unloaded to prevent spillage.
Price Your Project
Receive a free, custom quote for you project. Midwest Metal Fabrications can handle any job, small or large and is ISO 9001:2015 and AS9100 Certified.