M-Codes List For CNC Machine Programming

Miscellaneous Functions is another name for M-Codes. How are they different from the G-codes in my previous post? The G-code is a preparatory command for CNC programming, which presets, or prepares, the machine to use a certain cycle or mode. An M-code is an actual machine function.

A machine function is something that the actual machine does, whether it’s turning on the spindle or ending your program. Not every machine is the same because there are many different CNC machine manufacturers, as well as different controllers, so I recommend reading through your machine’s manual to see what M-codes you can use.

  • M00 – Compulsory program stop
  • M01 – Optional stop
  • M02 – End of program (no rewind, usually with reset)
  • M03 – Spindle on (rotate CW for R/H tools)
  • M04 – Spindle on reverse (CCW for R/H tools)
  • M05 – Spindle stop
  • M06 – Automatic tool change (ATC)
  • M07 – Coolant mist ON (optional)
  • M08 – Coolant ON
  • M09 – Coolant OFF
  • M19 – Spindle orientation
  • M30 – Program end (always resets & rewinds)
  • M48 – Feedrate override cancel OFF (deactivated)
  • M49 – Feedrate override cancel ON (activated)
  • M60 – Automatic pallet change (APC)
  • M78 – B axis clamp (nonstandard)
  • M79 – B axis unclamp (nonstandard)
  • M98 – Subprogram call
  • M99 – Subprogram end

M-Codes List For CNC Machine ProgrammingUnlike a G-code, you can only use one M-code per line/block of code. Using an M03 and M04 is not possible because they do two opposite functions.

The more M-codes you try out, the more efficient you can become. M98 can significantly decrease programming and possibly cycle time because it calls up a sub-program that can be repeated over and over any given number of times.

There are more Miscellaneous functions than listed above, which are referred to as ‘machine specific codes’. You will have to learn the codes used by your individual machine and controller to get the most out of your CNC machine, whether it’s a milling or turning center.

Basic Machining Tools – Terminology

There are a lot of tools used in machining today, so it’s often hard to keep up with the names of all of them, especially if you’re new to this career. Every tool has a specific job, and while a variety of tools may be able to get the job done, some are better than others.

Just so I don’t overload you, I’ll go through a list of the most common tools used in Machine shops, as well as Machine Tech schools. Each tool has a specific purpose, and there are many different kinds of the same tool. The more tools you use, the more knowledge you will get and know what works better for a certain material or operation. However, you must get an understanding of the of machining tools before just using any specific one without knowing what it’s meant to do.

End Mill

The almighty ‘End Mill’ is one tool that you will use almost every day if you run milling machines. If you need to cut both ends of a part to get it to a certain length, and end mill will side-mill the ends to make a clean and parallel surface. It can cut out pockets, and make square or round features in a part. There is so much that you can do with an end mill on a CNC milling center.

3-Flute End Mill
3-Flute End Mill

Whether you need to rough out a large solid piece of steel, or you’re just making some finish passes on aluminum, there’s an end mill for each job and every one in between. There are many different kinds of end mills. Here are the main variables you will have to decide when ordering tools: size (diamter), length (flute length), material/coating, roughing/finishing, number of flutes, and more.

Drill

Need to drill a hole? How about a few hundred holes? While there may not be quite the selection for drills as end mills due to the fact that you can only do so much with them, there are definitely right and wrong drills for any given job. 118 degree HSS or coated drills are the most common since they work well with most basic materials. However, you may need a drill for a hard stainless job, or perhaps a copper part that requires a deep hole with a close tolerance.

 

Tap

There’s not much else you can do with a tap other than tapping holes. Are you doing a blind or a thru-hole? Is it a metric or a U.S. standard thread? If you’re on a mill, the most popular taps are: cut tap, roll form, spiral point/flute, as well as a thread mill.

Cut taps produce chips because they literally cut a thread into the existing hole. You must use a drill that meets the minimum diameter tolerance for the specific thread you want. They are used on thru-holes because the chips won’t get in the way of the tap.

A roll form tap does not make chips because it forms and pushes the threads into place. It’s great for blind holes because the tap won’t break from chips collecting at the bottom.

Ream

A ream is used after a drill or a bore to meet a close tolerance call-out on the blueprint. Cheap drills are far from perfect and can easily make a hole over-sized, which will be rejected if it’s not within print. However, if you drill the hole .010″-.015″ under-size, you can then use the correct size ream to get a much more accurate and consider hole.

Ream
Ream

However, you should know that a ream will not ‘fix’ a hole. A ream just follows a hole, so if it’s crooked or out of round, the tool will follow that path. This is one reason why you may need to drill the hole then use a boring bar to make it perfectly round and straight before you ream it to size.

That’s it for the basic tools on this article from CNC Machinist Training. Stay tuned for another article that explains more advanced tooling that makes it much easier to do a job…

CNC Machinist Training Requirements

Before working as a CNC Machinist, most companies require some previous experience or training. It could be getting certified at a Tech school, a certain number of years working with a number of machines and program controllers, or using specially tooling/machinery.

It really depends on the shop and what they’re looking for, but you should decide what kind of shop you’re wanting to work at in the first place so you know what to work towards.

Here’s some general requirements for each stage of a Machinist Career (Each level is a prerequisite for the next level)…

Basic Shop Helper/Student:

  • High School Diploma/Currently enrolled
  • Basic math knowledge
  • Hard worker
  • Punctual
  • Can Pass drug/background check
  • Ability to lift 30+ lbs.
  • Listens to authority
  • Quick learner and motivated

Entry Level Machinist/Operator:

  • 1-2 years of Machine trade school or previous experience
  • Ability to use basic inspection tools such as: caliper, micrometer, thread gauges
  • Be able to set tool/work offsets if needed
  • Can change out parts and properly deburr
  • Operate a band-saw
  • Occasional light assembly
  • Able to interpret blueprints

Mid-level CNC Machinist:

  • 3-5 years of previous machining experience and/or schooling in Machine Trades
  • Ability to do to set-ups on CNC milling machine or CNC Lathe
  • Ability to program and edit programs if needed
  • Some experience with CAD/CAM software preferred (depends on the position)
  • Ability to inspect own parts with proper tools
  • Math/Basic trigonometry skills
  • Basic knowledge of feeds and speeds for materials

Lead Machinist:

  • Good communication/interaction skills
  • Proficient in troubleshooting machine and program problems/alarms
  • 5 or more years of previous experience
  • Ability to teach and train new employees on machine operating, set-ups
  • Certified and experience with fork-lift operation
  • Report all maintenance and important issues to Manager
  • Understand the capabilities and limitations of each machine
  • Be a leader and organized

CNC Programmer/Engineer:

  • 2-5+ years of previous programming experience with CAD/CAM software (Gibbs,Surf,Bob,Mastercam,Solidworks,etc.)
  • Complete understanding of machine usage and programming G & M codes
  • Awareness of cutting tool technology
  • Complete understanding of work-holding strategies
  • Ability to make/utilize work fixtures with simple and complex parts
  • Strong tooling knowledge, as well as optimum feeds and speeds for each job
  • Ability to program for different machines; mill/lathe/4th axis/live tooling (if required)

CNC Machinist Training RequirementsNow not all of these are going to be the exact requirements for the job you’re applying for. However, it is important that you experience and can do all or most of the above in the given category for the job you want.

The more you know, the more your future employer will consider you. Having a strong resume doesn’t always get you the job, but it can help you get the wage/salary that you deserve based on your skill level.

Absolute Vs. Incremental – CNC Programming

To be able to write and edit programs, you must know when and how to use Absolute and Incremental modes effectively. More programs are in absolute, but there are times when it’s easier to use incremental.

There are major differences between to the two, so if you don’t know how each one works, don’t start programming until you read this. Mixing the two up can and will cause a disaster

What Is Absolute?

When programming in absolute, all of your coordinates and movement values will come from the origin (0,0) point. If you want to be in Absolute, the G-code that defines this is G90, which is a modal code.

Absolute Programming
Absolute Dimensioning

Most CNC programs are written in absolute because it is easier to understand. Why is it easier, you ask? Because if you have a lot of coordinates to move, you always know where the center of the tool is in relation to the work offset.

What Is Incremental?

How is Incremental different from Absolute? Well, instead of all of your coordinates/numbers coming from one location (0,0 offset), each move is the distance from your current location. That means if you want 2 holes that are 4.000″ apart and start 4.000″ from your start location, you would use X4.0 twice, as opposed to using X4.0 and then X8.0 for the second hole if you were to use Absolute. G91 is the G-code that puts you in Incremental mode, and it is modal as well.

Incremental Programming
Incremental Dimensioning

Which one is better? That depends on what you’re doing, but 99% of the time Absolute programming will be easier. If you’re hand-programming, it may require a little more math, depending on how the blueprint is laid out, but it will be much easier to go back and read or edit the program if there is a mistake.

In G90 (absolute), no matter where your tool is, you can always go move to a certain location by inputting those coordinates, such as X1.625Y-.875. However, if you’re in G91, you can’t just punch those numbers in if your tool is somewhere other than the origin. If you put in those coordinates, your tool will move a positive 1.625 in the X direction, and a negative .875 in the Y direction from where it currently is.

So, how do you get to that location in G91? You have to know where you tool is, then add or subtract the distance of the location from where it is relative to the origin. You see now why incremental can be very confusing? If you’re in G91 and have dozens, or even hundreds of moves, one mistake in the middle of the program and all of the following numbers will be skewed because they all come from the previous location.

On the flip side, you can alternate between G90 and G91. If it’s easier to use incremental for a few moves, use G91, then when you want to go back to absolute, just put a G90 on the line of the next move.