Miscellaneous Functions, M
The miscellaneous functions or M-codes are the ones used for operating the machine tool functions. Generally, only one-M code is supposed to be given in a single block.
Similar to G-codes, ISO has standardized a number of M-codes as follows :
Code Function
M00 Program stop, spindle and coolant off
M01 Optional programmable stop
M02 End of program - often interchangeable with M30
M03 Spindle on, CW M04 Spindle on, CCW
M05 Spindle stop
M06 Tool change
M07 Coolant supply No. 1 on
M08 Coolant supply No. 2 on
M09 Coolant off
M10 Clamp
M11 Unclamp
M12 Unassigned
M13 Spindle on, CW (+) coolant on
M14 Spindle on, CCW (-) coolant on
M15 Rapid traverse in + direction
M16 Rapid traverse in - direction
M17-M18 Unassigned
M19 Spindle stop at specified angular position
M20-M29 Unassigned
M30 Program stop at end tape + tape rewind
M31 Interlock by-pass
M32-M35 Constant cutting velocity
M36-M39 Unassigned
M40-M45 Gear changes; otherwise unassigned
M46-M49 Unassigned
M50 Coolant supply No. 3 on
M51 Coolant supply No. 4 on
M52-M54 Unassigned
M55 Linear cutter offset No. 1 shift
M56 Linear cutter offset No. 2 shift
M57-M59 Unassigned
M60 Piece part change
M61 Linear piece part shift, location 1
M62 Linear piece part shift, location 2
M63-M67 Unassigned
M68 Clamp piece part
M69 Unclamp piece part
M70 Unassigned
M71 Angular piece part shift, location 1
M72 Angular piece part shift, location 2
M73-M77 Unassigned
M78 Clamp non-activated machine bed-ways
M79 Unclamp non-activated machine bed-ways
M80-M99 Unassigned
In the following a few of the M-codes that are generally found in most of the controllers are described. The other M-codes should be checked in conjunction with the programming manual of the machine tool.
M00 Program stop or Pause. This would stop the machine after completing the instructions in the block. To continue further, the operator will press the 'Start' button on the control panel. This is generally useful for altering the clamp position or inspection.
M01 This is similar to above and is termed 'Optional stop'. This will stop like M00 when the "Optional stop" switch on the controller is 'ON'. This is normally used for random inspection.
M02 This is logical 'End of program'.
M03 This is the function to start the machine spindle in the clockwise direction. When it is given in a block would be the first code to be executed before all the other codes in a block are acted upon.
M04 This is the function to start the machine spindle in the counter clockwise direction. When it is given in a block would be the first code to be executed before all the other codes in a block are acted upon.
M05 This is used to stop the machine spindle. When it is given in a block would be the last code to be executed after all the other codes in a block are acted upon.
M06 is for tool change.
M07 is for 'Coolant 1 On'.
M08 is for 'Coolant 2 On'.
M09 is for 'Coolant Off'.
M30 This is also the 'End of program' and is called 'Rewind'.
Program Number
Generally, it is necessary to specify an identification for each of the program in terms of a program number. The symbol used for the program number in Fanuc controls is "O" or ":", followed by its number. For example, O238 or: 238. The programs are generally stored in the CNC controller memory using the program number.