EXPLANATION OF M-codes (miscellaneous)
M0 Program Stop
Will stop the desired program, when placed any where inside of a program.
M1 Optional Program Stop
This will provide a "optional" stop when placed inside of a program. Once this code is read it will stop the program, but by pressing "cycle start" the program will resume.
M2 Program End
This will end the desired program, but will not rewind.
M3/4 Rotate Spindle Clockwise/Counterclockwise
M03 will turn on the spindle, in a clockwise direction, M04 will turn on the spindle in a counterclockwise direction.
In order to use this "M" code you must designate a spindle speed, this is done with a "S"
(eg) m03 s3000 = spindle on in cw direction @ 3000 rpm
M5 Stop Spindle Rotation
Stop spindle.
M6 Tool Change (by two macros)
To do a tool change a few things must be done first, select a master tool (zero tool), set up other tools in tool table on Mach3. Once this done you would call a tool change like this,
Z2.0 (call the z up to a location to change tool)
G49 (cancel the previous tools height offset information)
(base rough 1/8 ENDMILL) (list which tool is to be changed)
M6 T2 (call the tool change and change preset tool, this will also stop the spindle)
M03 S3500 (start the spindle at 3500 rpm)
G04 P5. (give a 5 second pause to allow the spindle to get up to speed)
G43 H02 (apply the tool height information for this tool)
This same cycle must be present to change the tool, this will only work with preset tools (Tormach style tool holders).
One must not forget to call up the z, and cancel the tool height of the previous tool.
M7 Mist Coolant On
M8 Flood Coolant On
M9 All Coolant Off
M30 Program End and Rewind
This is most commonly the last line of code to end a program, and it will rewind to the start of the program.
M47 Repeat Program from First Line
M48 Enable Speed and Feed Override
I have found this to be an important line of code to add at the start of your program, as it will allow you to manually adjust feed-rates during the operation of a program. If the program is running and you notice that you may have entered a feed-rate that is too fast, this will allow you to adjust the feed-rate via typing in a new one or use the sliding bars (located on the program run screen in Mach3).
M49 Disable Speed and Feed Override
M98 Call Subroutine
M99 Return from Subroutine/Repeat
The modal groups for M codes are:
stopping {M0, M1, M2, M30}
tool change {M6}
spindle turning {M3, M4, M5}
coolant {M7, M8, M9} (special case: M7 and M8 may be active at the same time)
enable/disable feed and speed override controls {M48, M49}
(copyright) Syil Canada 2009
Do not use with out permission