CNC | M Codes | Miscellaneous Functions

In this article, we describe general information about CNC Miscellaneous Functions which is called usually M Codes.

0
567

The address M in a CNC program identifies a miscellaneous function, sometimes called a machine function. Not all miscellaneous functions are related to the operation of a CNC machine – quite a few are related to the processing of part program. The more suitable term miscellaneous functions is used throughout this article.

Description and Purpose

Within the structure of a CNC program, programmers often need some means of activating certain aspects of machine operation or controlling the program flow. Without availability of such means, any part program would be incomplete and impossible to run. First, let’s look at those miscellaneous functions that relate to the operation of a CNC machine – the true machine functions.

Machine Related Functions

Various physical operations of a CNC machine must be controlled by the program, to ensure fully automated machining. These functions generally use the M-address and include the following operations:

  • Spindle rotation : CW or CCW
  • Gear range change : Low / Medium / High
  • Automatic tool change : ATC
  • Automatic pallet change : APC
  • Coolant operation : ON or OFF
  • Tailstock or quill motion : IN or OUT

These operations vary between machines, due to the different designs by various machine manufacturers. A machine design, from the engineering point of view, is based on a certain primary machining application. A CNC milling machine will require different functions related to this type of machine than a CNC machining center or a CNC lathe. A numerically controlled EDM wire cutting machine will have many special functions, typical to that kind of machining, including those not found on other machines.

You may be interested also “CNC Manual Data Input | MDI Mode”

Even two machines designed for the same type of work, for example, two kinds of CNC vertical machining centers, will have functions different from each other, if they have a different control system or significantly different options. Various machine models from the same manufacturer will also have certain unique functions, even if the CNC systems are identical.
All machine tools designed for metal removal by cutting have certain common features and capabilities. For example, spindle rotation can have three – and only three – possible selections in a program:

  • Spindle normal rotation
  • Spindle reverse rotation
  • Spindle stop

In addition to these three possibilities, there is a function called the spindle orientation, also a machine related function. Another example is coolant. Coolant can only be controlled in a program as being either ON or OFF.
These operations are typical to most CNC machines. All are programmed with an M- function, typically followed by two digits, although some control models allow the use of a three digit M-function, Fanuc 16/18, for example.
Fanuc also uses three digit M-functions in several special applications, for example, for synchronization of two independent turrets on a multi-axis lathe. All these and other functions are related to the operation of CNC machines and belong to the group collectively known as miscellaneous functions or simply as the M-functions or M-codes.

Program Related Functions

In addition to the machine functions, several M-functions are used to control the execution of a CNC program.An interruption of a program execution requires an M-function, for example, during the change of a job setup, such as part reversal. Another example is a situation where one program calls one or more subprograms. In such a case, each program has to have a program call function, the number of repetitions, etc. M-functions handle these requirements.
Based on previous examples, using miscellaneous functions falls into two main groups, based on a particular application:

  • Control of machine functions
  • Control of program execution

Unfortunately, there are many functions that vary between machines and control systems. These functions are called machine specific functions. For this reason, always consult documentation for the particular machine model and its control system.


Need to More?

Our volunteers have worked together and carefully prepared the articles published here in their native language without using machine translation. You can search the entire site for more information on the subject. You can start a discussion on CNCarea.com forums and join us to get support, ask questions, improve a published article or give your opinion.


Previous articleG00 Code | Rapid Movement
Next articleCNC | Programming Formats