Tag Archives: CNC maintenance

Deciphering M CODES for Your CNC Machine

Recently we have been working with some Kipware® conversational clients assisting them in setting up their Kipware® post processor blocks for their G code output. With the addition of our EIA MENU option … users now have greater flexibility in using machine functions ( M ) functions in their G code to accomplish specific tasks. One example might be … parts catcher UP or DOWN to catch a part being parted-off … or chuck OPEN and CLOSE during a bar feed operation … or 4th axis CLAMP and UNCLAMP for CNC mill.

During these sessions we are coming across the situation where the end user doesn’t know the specific M for their machine to accomplish some of these tasks. And for whatever reason … manuals lost or misplaced … machine was purchased used and no manuals were included … or whatever … the end user does not have any Operator or Programmer manuals for their machine which would normally outline the M codes and their function. Without the manuals … they have no way of finding out what M functions control what. OR DO THEY ??

Let’s start this journey with a brief explanation of the HOW’s and WHY’s of CNC M functions. 

  1. First … there is no “industry” standard for M functions. Although you might find that M08 and M09 or M03 and M04 work for most CNC machines … there is not an industry standard that says they must meet a certain criteria.
  2. M functions are designed by the machine tool builder … not the control manufacturer. So you may have (5) Fanuc controlled machines in your shop … some Mori Seiki’s some Hitachi some Leadwell … all with different M functions. Because the M function circuits are designed by the machine tool builder and not Fanuc.

With those basic facts … when you ask your buddy “What’s the M function to open the chuck?” … and he says “M11” … and it doesn’t work on your machine … now you know why.

So how can you find out the M functions for your machine WITHOUT an Operators or Programming manual?

One of the best ways is to use either the electrical or ladder diagram for the machine. Although most Operator or Programming manuals get lost along the way … mostly because they are not kept with the machine but rather float around the office or shop … electrical diagrams ( which outline the electrical circuitry of the machine ) and ladder diagrams ( which outline the logic of the machine ) are most often kept inside the machines electrical cabinet. Open up the doors and you will usually find one or the other or both.

Even if you’re not electrical savvy … the circuits are pretty clearly labelled and you can find say the CHUCK OPEN circuit and trace things back to find the appropriate M function. Again … because they are built and designed by the machine tool builder and their electrical outline is outside the realm of the control … these circuits are contained in the machines electrical documentation … not the docs for the control.



Above is a pic of an electrical diagram for a Shizuoka CNC vertical mill … with an exploded view on the bottom. You can see fairly easily even without any electrical savvy that the M10 command will control the 4th axis clamping function. 

With today’s more sophisticated controls … oftentimes the ladder diagram is available directly on the machine controls CRT. You can pull up the ladder and even search for the appropriate function command … but in other cases the “old fashioned” printed ladder can also usually be found in the machines electrical cabinet.

Taking a look at either the electrical diagram or ladder will usually result in some additional road or path to travel to find the appropriate M function on your machine. A simple execution of an MDI command is a good test to see what happens. The old Trial and Error method will open up additional doors or produce the desired results.

M functions are powerful options on your CNC machine that can help automate many tasks and make your manufacturing more efficient. Know that you know the trick to discovering the M functions on your CNC machine … why not peruse your electrical or ladder diagram and see if there are any you might be missing in your programming?

Like what you see?
Please visit us at www.KentechInc.com

Kenney Skonieczny – President
Kentech Inc.

Way Lube System – Friend or Foe?

Your CNC machine is equipped with an automatic oiler system. Great ! You won’t have to think about oiling the machine and an alarm will tell you when the tank is dry. What a great device ? Right ?

Well, that is the design. Unfortunately, along with the “automatic” description of the system comes the “out of sight, out of mind” aspect of the system. Because many people know it is an automatic system, many people put it out of their minds and simply wait for the alarm to come up showing that the tank is empty and needs to be filled. But what if that alarm never comes on because the tank isn’t empty ? Why wouldn’t the tank be empty ?

As your machine gets older, the way lube system will require service just like any other mechanism. The main problem, which often gets overlooked, is that the “tank empty” alarm never comes on because the tank never drains and nobody ever notices it. Now your machine runs for months on end with no lubrication on the ways and when you finally notice a problem, it’s too late. Here is the “Rest of the Story …”

PROBLEM :  The machine’s ways are not receiving any way lube oil.


  • Positioning / Repeatability Problems
  • Axis makes noise when moving
  • Axis Drive motor overload alarm coming when the axis is moving


  • Way Lube Pump burned out.
  • Way Lube Pump distribution flow set too low.
  • Way Lube Pump filter CLOGGED
  • Way Lube line BROKEN
  • Metering Units are CLOGGED


(1) Way Lube Pump Burned Out : If the way lube pump is burned out, obviously there will not be any lube getting into the system. These pumps are usually set using a timer system. There is basically two types of timer systems used :

  • The pump is on a cam and the way it works is that the pump is always running. One gear turns another which acts like a step-down system and the second gear raises a “primer” lever. When the lever reaches the top of the stroke, the “primer” lever is released and the oil is pushed into the lines. This whole cycle can take 5-20 minutes meaning that even though the pump is always running, the lines get lube only every 5-20 minutes.
  • How to Check It : Take a flashlight and look in the tank or remove the oil tank. Once looking inside, you can see the main gear that should be constantly moving. It may be at a very slow pace, but you will see it moving.
  • The pump is set to an electrical timer set in the controls PC (programmable controller) or an actual physical electrical timer in the cabinet. This type of timer only supplies power to start the pump for every cycle.
  • How to Check It : On some pumps there is no primer lever but a light comes on on the tank when the pump is activated. Make sure this light comes on every 5-20 minutes or some other sign comes on to show the pump is activated every 5-20 minutes.

(2) Way Lube Pump distribution flow set too low : As stated above, the way lube pump usually is set using a timer system. The flow amount that gets distributed into the lines during every cycle is usually set and adjusted at the pump with a manual setting mechanism. This type of adjusting mechanism is usually a knob that can be turned higher or lower to set more or less flow. Also, just look at the primer lever. During the mentioned 5-20 minute cycle, you should see the primer lever raise slowly and then start to drop after reaching the top of the cycle. Check the stroke of the lever – short stroke, less flow.

  • How to Check It : The normal pump usage is in an 8 hour shift, you should fill the tank every 2-3 days. Also, you should see way lube flowing onto the ways. Always remember, the more flow the better. Yes, it may contaminate the coolant but that is better than ruining the ways and thus the machine just to save a couple of bucks.

 The photo above shows a way lube pump unit which includes a manual flow control device. Adjusting the white knob adjusts the amount of lube being distributed per one cycle of the lube pump. When this type of pump is working correctly, you can see the white knob rising slowly then retracting, pushing the lube into the lines. The amount of rise and fall, and therefore the amount of lube distributed, is determined by the flow adjustment.

(3) Way Lube Pump filter CLOGGED : The way lube tank usually has a filter between the tank itself and the oil line that starts the distribution. This filter is usually in the tank itself at the bottom of the primer lever or in-line right after the main distribution line leaves the tank. It will get clogged over time, especially if there is no filter at the oil fill hole or if someone takes off the filter when filling the tank.

  • How to Check It : Disconnect the main lube line where it exits the tank to feed the system or after the in-line filter if so equipped. When the cycle reaches the pump stage as outlined above, oil should flow through this connection. The flow should be strong at this point. If not, remove the oil tank and search out the filter or remove the in-line filter. They can often be cleaned with a cleaner but the best remedy is to replace it.

(4) Way Lube line BROKEN : Oftentimes a lube line in the system gets crimped or broken during machining or during service. These way lube systems are usually “pressurized” so to speak and if the pressure is released at one point, say at the broken line, the oil will flow all to that point, depriving all the other lines of fluid.

  • How to Check It : When the pump is in the pumping stage, the primer lever should fall slowly. This is due to the fact that it is pushing the oil into the system. If a line is broken, the primer lever will fall quickly as all oil is funneled to the broken line area only. On systems without a primer lever, the pump may have a pressure gauge on the pump. During the pumping cycle, the pressure should register for a couple of seconds as the oil is pumped into the lines. If the pressure is low or does not come up at all during the pumping cycle, a line in the system may be broken.

(5) Metering Units are CLOGGED : In order to create the “pressure” of the system needed for even distribution, each oil line leads to a “metering unit” where the flow is lowered and the oil is discharged. When the pump forces oil into the lines, they all fill and flow to the metering units where the flow is stopped. Each metering unit is set to discharge the desired amount or “drops” of oil and perform their individual duties. Since some areas require more lube, the metering units can be different for each line or area. Since these metering units have actual valve type components in their very small bodies, over time these units can be become clogged or the inner workings can become stuck.

  • How to Check It : This is a much harder area to check. The best remedy and prevention is to change these units every year as part of a yearly maintenance program. Because these units allow only drops to flow through, they are harder to see when troubleshooting. These metering units are usually located in “clumps” around the machine. Several lines lead to these central areas and lube lines are branched out from here to the various areas of the machine. Replacement metering valves should be obtained from the machine tool builder or dealer to insure that you are getting the correct replacement part. When changing these units, pay close attention to the flow arrow that is commonly marked on the units themselves. This arrow shows the direction of installation and flow. Check the original unit before removal and replace accordingly.

 The photo above shows an example of some metering units. These individual fittings are usually located in one or two main terminal blocks that feed certain areas of the machine such as the axis and ball screws. As the system fills with pressure and lube, these fittings discharge the lube at their pre-set flow rate into their lube lines. Over time, like cholesterol in the arteries, these units become clogged and no longer allow lube to exit and thus deny vital areas of the machine the way lube they require. As part of a yearly maintenance program, metering units in the machine should be replaced as a precautionary measure.

Due diligence and a little tracking will insure your Happy ( and ACCURATE ) Chip Making for years to come !!


 Check out our Real World World machine shop software at www.KentechInc.com

Conversational CAD/CAM
Quoting & Estimating
G Code Conversion
CNC Training
…. and MORE !!!