Posted by: davidhayden | March 1, 2012

Most Common Turning M Codes for CNC Programming

Most Common Turning M Codes 

The following is a list of Comming CNC Programming M Codes for turning applications.  These are excerpts from 7 Easy Steps to CNC Programming Book II, Beyond the Beginning.

For the list of CNC Programming G codes for turning applications see previous post.

M Code 

CNC M Code Group 

What CNC M Code does /
How to Use the CNC M Code

M0 / M00 


Program  Stop.  Suspends program execution. 

M1 / M01 


Optional Stop.  Only suspends program execution if the optional stop button on the machine’s operator panel is toggled to optional stop mode. 

M2 / M02 


Program End.  Tells the control it is at the end of the program and resets all the modal commands to the machine. 

M3 / M03 


Modal. Clockwise Spindle Rotation. Starts spindle rotation in a clockwise direction. 

M3 / M04 


Modal. Counter-Clockwise Spindle Rotation. Starts spindle rotation in a counter-clockwise direction. 

M5 / M05 


Spindle Stop.  Stops rotation of spindle. 

M8 / M08 


Flood Coolant On. 

M9 / M09 


Coolant Off. 



Clamp Chuck. 



Chuck Un-Clamp. 



Program End and Rewind.  This command tells the control it has reached the end of the program and resets the cursor to the first line of the program.  Back in the “old days,” the M30 would cause the NC tape to rewind back to the beginning. 



Sub-Program call. (See page 29) 



Return to Main Program. (See page 29) 



Loop program.  When used in a program that was not called as a subprogram, the M99 returns the cursor to the start of the program and continues execution.  This can be handy when running jobs with a bar feeder.  Instead of programming an M30, you can program the last two lines to read:  
The M01 will allow the operator to stop the program for taking breaks, shift change, changing bar stock, or whatever reason.  Until the Optional Stop switch is toggled ON, the machine will keep looping through the program.  

Once the Optional Stop button is toggled ON, the machine will stop just prior to reading the M99.  The operator can do what ever needs doing, then hit the Cycle Start button. The program will resume operations from the beginning. 

Watch for future posts that will feature G and M code lists excerpted from 7 Easy Steps to Cnc Programming . . . Beyond the Beginning


  1. Thanks for the upload.
    please upload for AMS machines knowledge

  2. This is amazing. I wonder if you can use these same codes to get something like this:

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s



Get every new post delivered to your Inbox.

Join 392 other followers

%d bloggers like this: