List of M - Codes for ALL CNC Machines

Machine & Design
2 followers
12 Video Views·Oct 30, 2024
M-Codes direct the auxiliary functions of a CNC machine such as coolant and spindle control. M-Codes often have different uses across machine controls but a few remain standard that most machines typically share.
Hello my name is Mark from G-Code Tutor and I'm here today with Practical Machinist
to talk about M codes that are universal across all CNC machines.
So this is a list of M codes that we're going to be discussing during this video.
So we're going to look at each one and look at them in a program to see how they work.
Okay so let's take a look at the first slide. This is the program that we have our M codes in.
Now I wouldn't suggest that you type this program into your machine. I
wrote it very quickly just to describe these M codes. Okay so let's have a look see what we have
here. So I'm going to start off talking about M00 and now this is our program stop M code.
So what this does when the machine reads this M code it stops, it allows us to open the door,
check the part and carry on once we've hit cycle start. So this M code is very useful if we need to
say stop the machine to add cutting compound to a tap or maybe we need to check a part each time
we run the machine for a critical dimension such as a bore. So where do we place this M00 M code?
Well I normally add it to the end of a sequence instead of an optional stop. Now talking about
optional stop we have an optional stop M code which is M01 and this can be shortened to M1.
So our M01 M code will allow us to stop the machine if we require by pushing the
optional stop button on our controls. It works the same way as our program stop the M00 but we can
turn the option on and off on the button on our controls so we don't always have to stop the
program at that point if we don't wish. Now this would normally be used for again after each
sequence just so we can stop the machine check the sequence make sure the dimensions are correct
then hit cycle start to carry on with the next sequence. So if we have a problem bore for example
that's not maintaining size we can add an optional stop after that sequence so we can check the bore
if we wish. So these next three M codes are all very much related and these all work on both a
and a miller machine by the way. So M03 would turn our spindle on in a clockwise direction
now this could be the spindle of a lathe or it could be the spindle of a miller machine
so this is our directional M code to start our spindle and if we wish our spindle to rotate in
the opposite direction which quite often we do on a lathe depending on the orientation of our tooling
we would use M04. Now this starts our spindle in a counterclockwise or anti-clockwise direction
now to stop our spindles we would use M05 now this just turns our spindle off applies the brake
and stops it from rotating so we would do this before the end of the sequence so we can open the
doors and check our parts if need be without a live spindle there. So the next M code I wish to
talk about is M06 this is our tool change M code so once we've told the machine what tool we are
using we would use M06 to perform a tool change now on a CNC lathe this would rotate the turret
and bring the tool we've called into position ready to cut or on a CNC mill it would perform
a tool change from the carousel and put a new cutter into our spindle for us so once we've
declared what that tool is we then perform the actual tool change by using the M06 M code now
when machining we need to keep things cool we have to use coolant not just to remove the heat
from the tool but it also helps lubricate our cutter to ensure that we have a nice smooth cut
and a good finish so to turn on the coolant we use M08 now a lot of machines have different
coolant systems we may have spray coolant mist coolant through spindle coolant for example now
all of these have different M codes but one M code all machines have in common is the M08 now
this turns on the coolant now often that could be all the coolant it depends on the machine's setup
and of course the opposite of M08 is M09 now this turns off all the coolant in the machine
it turns off all the coolant pumps whether it's through spindle whether it's through tooling or
overhead coolant and the final M code one we use at the end of the program is M30 now M30
stops the program and it rewinds it back to the start where it doesn't actually rewind the program
anymore because it's not a physical tape but it does take us back to the start of the program
and it will continue running from there if we have continuous cycle on now continuous cycle is a
feature that we find on CNC lathes as it reaches the end of the program it would rewind back to
the start and if we have continuous cycle selected it will start reading that program again of course
on a milling machine we would need to load a new billet at this point so the cycle does not
continue so these slides are from my foundation course this is a introduction to CNC programming
using G code and you can find out more about this course over on my website now it's mainly
focused on CNC milling machines but we also use it to learn the basics of CNC turning as well
and then once you've completed a foundation course you can choose your path whether you go milling
or turning within the course so for more on this subject pop over to my website gcodetutor.com
where I have a lot of free articles and some paid courses which these slides came from
