Do you know all of your M-codes? - Column
Categories: CNC M CodesMachine tool builders vary dramatically when it comes to what they allow you to do with M-codes. Some are quite limited in this regard while others allow you to control almost everything by M-codes. Too many times programmers ignore all but the most basic M-codes when working with their particular CNC equipment. They don’t even consider the possibility that an M-code may be available to help with a particular application. This is especially true when a new programmer takes over the programming of an existing piece of CNC equipment.
One of the first things you should do whenever you begin working with any machine is to study the list of M-codes available. You will normally find the list of M-codes supplied in the machine tool builder’s manual (not the control manufacturer’s manual). You may be surprised at what you find. For any M-codes that do not make sense, contact your machine tool builder to learn their usage.
Neglecting your M-codes list can cause problems ranging from inconvenient to downright damaging to the machine tool. For example, on a turning center you may find you have control of your chuck’s clamping direction (internal or external) by M-code. This would make it possible to easily program first and second operations on a workpiece within the same program (turning the part around after the first end is finished) in conjunction with outside diameter and inside diameter chucking. Maybe the first operation chucks on the outside of the workpiece and the second chucks in the inside. Without knowing these M-codes exist, you wouldn’t consider this a possibility.
In more extreme cases, you could cause damage to the machine. For example, say a company has a horizontal machining center with a rotary (B) axis incorporated in the table. And say the programmer is supposed to specify an M-code to clamp the table before performing any heavy machining operations on a particular side of the table (though not all rotary axes require this). Not doing so would place undue strain on the B-axis drive motor and drive mechanism, and this system would wear out much faster than it should have.
Applications for M-codes
The primary application for M-codes is to allow programmable on/off switches for mechanical devices. This allows the programmer to activate mechanical functions like spindle, coolant, chuck jaws, hydraulic clamping, tailstock, and indexers. Again, some machine tool builders give the programmer control of almost everything (even chip conveyors, worklights, and protective doors) while others are quite limited in this regard.
A second application for M-codes is to allow programmable on/off software related switches. Usually these functions are related to some feature of programming. For example, some machine tool builders allow the programmer to control whether optional block skip (or block delete) is on or off through M-codes. M12 may be used to turn on this feature and M13 to turn it off. Other applications for M-codes in this category include enabling and disabling feed rate override, controlling thread chamfering for turning centers, controlling how cutter radius compensation is handled for rounding corners, and controlling whether mirror image is turned on or off.
Some rather obscure M-codes
As you look through your M-codes list, be prepared for some rather obscure functions. You may find, for example, you have control of whether an M-code is activated at the beginning of a motion command or at the end. So you may find you have control of whether the machine will turn itself off at the completion of the program (for unattended use). You may also have control of how many “look ahead” commands the control will use with cutter radius compensation.
These are but a few of the rather unusual uses for M-codes. It may take quite a bit of study to understand the implications of when these codes can help.
Adding M-codes
Keep in mind that most machine tool builders allow the end user to add M-codes as required. This may be necessary, for example, on a vertical machining center when adding an indexer to the machine. This kind of M-code interface usually requires the assistance of the machine tool builder. Other examples of after-market devices that can be interfaced with M-codes include hydraulic clamping systems for machining centers, programmable steadyrests for turning centers, and bar feeders for turning centers.
http://findarticles.com/p/articles/mi_m3101/is_16_56/ai_16112816