Numerical Control Programming
Chapter 3
Programming: Making N/C Do What You Want


Miscellaneous Commands

Miscellaneous commands are those that use the address word M followed by two digits. Most M-codes are modal, that is they stay in effect until changed or canceled. They are used to perform such functions as to interrupt the execution of the program so the operator can reposition the workpiece or move a clamp; initiate an automatic or manual tool change; turn the spindle on, clockwise or counterclockwise, or off; turn the coolant to a flood or spray mist, or turn it off; retract the quill; engage and disengage hydraulic clamps; signal the end of a program and rewind the N/C tape or the CNC's memory; and actuate relays that control other functions unique to a particular N/C machine.

As with the G-code commands (preparatory and calling functions), much variation exists. The following descriptions, while typical of many controllers, are not applicable to every N/C controller and do not necessarily conform to the EIA-274-D standard. The programmer is advised to consult the programming manual for the particular controller being programmed.

Miscellaneous Commands
M00 (M-zero-zero) is a code that interrupts the execution of the program. The N/C machine stops and stays stopped until the operator depresses the START/CONTINUE button. It provides the operator with the opportunity to clear away chips from a pocket, reposition a clamp, or check a measurement.
M01 (M-zero-one) is a code for a conditional--or optional-- program stop. It is similar to M00 but is ignored by the controller unless a control panel switch has been activated. It provides a means to stop the execution of the program at specific points in the program if conditions warrant the operator to actuate the switch.
M02 is a code that tells the controller that end of the program has been reached. It may also cause the tape or the memory to rewind in preparation for making the next part. Some controllers use a different code (M30) to rewind the tape.
M03 is a code to start the spindle rotation in the clockwise (forward) direction.
M04 is a code to start the spindle rotation in the counterclockwise (reverse) direction.
M05 is a code to stop the spindle rotation.
M06 is a code to initiate the execution of an automatic or manual tool change. It accesses the tool length offset (TLO) register to offset the Z-axis counter to correspond to end of the cutting tool, regardless of its length.
M07 turns on the coolant (spray mist).
M08 turns on the coolant (flood).
M09 turns off the coolant.
M10 & M11 are used to actuate clamps.
M25 retracts the quill on some vertical spindle N/C mills.
M30 rewinds the tape on some N/C machines. Others use M02 to perform this function.

Back to the top of this page

Automatic Tool Changing

Automatic tool changing (Figure 3.4) is accomplished by issuing a M06 command to stop the axes for tool change. This command is followed by the address letter T and the number of the tool. In addition to activating the automatic tool changer, it also accesses the appropriate TLO register to offset the Z-axis, to account for any variation in cutting tool length.

Click inside to open a larger image of Figure 3-4 Automatic tool changer on a machining center   --->  Click for larger image of Fig. 3-4

Back to the top of this page

Next:  Spindle Speed Selection

Back to Contents Page


Updated Jan. 9, 2002
Copyright © 1988-2002 by George Stanton and Bill Hemphill
All Rights Reserved