CNC M Codes Introduction

I am sure you might have read my previous blog post about cnc machine G-code. As the previous post illustrates that the G-codes instructs the cnc machine about the machining contour and about the cutting tool feed and about the cnc spindle speed.

The same way another type of codes exist to control the actual machine workings, these codes are called cnc machine M-Code. The M codes controls the actual cnc machine hardware and cnc machine working.

M-Codes as CNC Program Control Instructions

M codes controls cnc program executions such as the cnc machine program execution Stop (M00 M01 M02) . With the help of M codes we can not only stop the actual cnc machine program execution but also we can even reset the cnc machine program (M30).

M-Codes as CNC Machine Control Instructions

CNC M Codes Introduction for CNC Machinists

CNC M Codes Introduction for CNC Machinists

If you read all the M-codes you will notice that most of the cnc m-codes are actually cnc machine hardware control instructions.

Let us start from the cnc machine spindle related m-codes.

The M03 m-code instructs the cnc machine that the cnc machine spindle must start to rotate in clockwise direction (Although there are conditions which must be met to make cnc machine spindle ready before we apply the M03 the conditions are as the spindle speed in RPM(Revolution Per Minute) must be given with the G-code G97 and cnc machine Gear must be selected with M41 or M42 and cnc machine spindle must be in close position for some cnc machines the safety guard must also be closed wheoo…. calm down now your cnc machine spindle must rotate).

Likewise M04 instructs the cnc machine to rotate the cnc machine spindle in counter clockwise direction.

The same way M05 instructs the cnc machine to stop the cnc machine spindle rotation at all.

There are other such m-codes as M08 M09. The M08 is to switch on the cnc machine coolant and M09 to switch off the cnc machine coolant. Although on some cnc machine M07 is also used to switch on the cnc machine coolant but on such cnc machine there are actually two ways for the coolant flow, so to use the other way we can use M07, But for normal use which is coolant flow through the cnc machine tool’s coolant nozzle we use M08.

As stated above the M41 M42 m-codes are cnc machine Gear control m-codes. Normally every cnc machine has gears to manage the spindle speed but there are exceptions.

I hope you might have enjoyed this blog post about cnc machine m-codes.