As you know, M codes are miscellaneous functions – which can also be thought of as machine functions. They tend to command programmable on/off switches, like spindle on/off and coolant on/off. As you probably also know, they are determined and developed by machine tool builders – not the control manufacturer. So two identical Fanuc controls used on two (even similar) machines provided by two different machine tool builders will likely have a different lists of M codes.
Some M codes are pretty universal. M03, M04, and M05, for example, are used by almost all machine tool builders to turn the spindle on and off (M03: fwd, M04: rev, and M05: off). The same goes for flood coolant. M08 turns it on and M09 turns it off. The same goes for program stop (M00), optional stop (M01), and end of program (M30 or M02).
Some M codes vary from builder to builder even for pretty common features. One turning center manufacturer, for example, may us M41 and M42 to specify low and high spindle ranges while another uses M23 and M25.
For unique – or more obscure – features, no two machine tool builders seem to agree on which M code numbers should be used. If you have a high pressure coolant system, for example, you’ll have to reference you machine tool builder’s programming manual to find out which M code activates it (and turns it off). And if you have more than one machine with this feature, you’ll likely find that different M code numbers are involved.
Since M codes are not universal (again, they’re far from it), you must actively study your machine tool builders’ programming manual/s in order to find the full list for each machine your company owns. Some may be pretty self-explanatory once you see their descriptions, but for any you don’t understand, of course, you shouldn’t stop digging until you fully understand them.
There are some situations when not knowing the M codes for your machine may lead to real problems. Consider, for example, a machining center that has a rotary axis. The machine tool builder has provided two M codes related to the rotary axis – one to clamp it in position (to allow powerful machining operations) and another to unclamp it.
If you don’t know the clamp/unclamp M codes, you’ll be overly taxing the rotary axis (causing undue wear and tear) whenever you index it into a position and perform powerful machining operations.