Pages

Wednesday, August 24, 2011

G-Codes, M-Codes And Do I Have To Be An Expert On Them

What is an M-Code?
M-Codes are related to G-Codes. M-Codes control different machine functions. Some of these functions are turning the machine on and off. Turning the spindle on or off. Turning a plasma torch on or off. Turning coolant on or off. You get the idea. When programming your CNC machine you may need to perform these functions.

Like G-Code, M-Codes vary from manufacturer to manufacturer and from machine to machine. As you can imagine you would need an M-Code for turning a plasma torch on and off on a CNC Plasma Cutting Machine. You wouldn't need an M-Code to turn a spindle on and off though. Hey, the machine doesn't even have a spindle.

Do I need to be a G-Code Expert?

M-codes
In a word, no. You will probably need to know how to quickly scan your G-Code if you are having problems during your machining simulation. Other then that G-Code and a CNC program are throwaway programs for the most part. What do I mean by that? Let me explain.

Let's look at a specific design. Let's say a 12" by 12" square. You build your model, run it through your CAM Software and create a CNC Program made up of G-Code instructions to your machine. Say tomorrow the job requirements change to a 24" by 24" square. Do you go into your G-Code line by line and change the code? Most people wouldn't. They would go back into their CAD or CAM program and scale the square up to 24" by 24". Then post-process the job again to get their G-Code program.

There are some people that would do this line by line because the design is simple. Now think of a complex shape and what scaling it up or down would entail. Massive changes to the G-Code and reviewing it line by line. We are talking thousands of lines here vs. going back and quickly scaling the model and spitting out some new G-Code. And that is why G-Code is throwaway. Use it over and over when you can, but don't fret over archiving it if something changes. It is much better to make a copy of the design (CAD File) in its original state and save that somewhere. That is much more useful.

CNC - G codes




Post Processing - Ok, you have me worried. With all the variations in G-Codes and M-Codes, how will I ever keep it straight?

Don't worry about that. The CAM program you choose will have many Post Processors. Post Processors are like translators. They help the CAM Program spit out the right G-Codes for your specific machine. All you have to do is select the right Post Processor before you spit out the G-Code. That is simple.

Most CAM programs have many machine specific post processors already loaded. All you do is to the list of them and click on your machine to select it. If you build your own machine, there are generic post processors loaded for different types of machines. Usually you pick a generic one and modify it a bit with a little testing. You are making sure a move in the X-Axis positive direction really means what you want it to mean.

No comments:

CNC Machine Popular Posts