5238-E P-47
SECTION 5 S, T, AND M FUNCTIONS
4.
M Functions (Auxiliary Functions)
[Function]
The M codes are used for miscellaneous ON/OFF control and sequence control of the machine
operation such as spindle start/stop and operation stop at the end of program. The programmable
range for M codes is from 0 to 511.
[Examples of M codes]
The M codes listed below are processed as special functions.
For details on those M codes not listed here, refer to APPENDIX 3. "List of M Codes".
(1) M00 (program stop)
After the execution of M00, the program stops. If the NC is started in this program stop state,
the program restarts.
(2) M01 (optional stop)
When M01 is executed when the optional stop switch on the machine operation panel is ON,
the program stops. If the NC is started in this optional stop state, the program restarts.
(3) M02, M30 (end of program)
These M codes indicate the end of a program.
When M02 or M30 is executed, the main program ends and reset processing is executed. The
program is rewound its start. (In the case of a schedule program, execution of M02 or M30 in
the main program does not reset the NC.)
(4) M03, M04, M05 (spindle CW, CCW, stop)
These M codes control spindle rotation and stop; spindle CW (M03), spindle CCW (M04), and
spindle stop (M05).
(5) M12, M13, M14 (rotary tool CW, CCW, stop)
These M codes control rotary tool rotation and stop for the turning center; rotary tool stop (M12),
rotary tool CW (M13), rotary tool CCW (M14).
(6) M15, M16 (C-axis positioning direction)
These M codes control the C-axis rotation direction for positioning for the turning center; C-axis
positioning in the positive direction (M15), C-axis positioning in the negative direction (M16).
(7) M19 (spindle orientation)
This controls spindle orientation.
(8) M20, M21 (tailstock barrier ON, OFF)
These M codes set and cancel the tailstock barrier which generates an alarm if the tool enters
the area defined by the barrier; tailstock barrier ON (M21), tailstock barrier OFF (M20).
(9) M22, M23 (chamfering ON, OFF for thread cutting)
These M codes set and cancel chamfering for thread cutting; chamfering ON (M23), chamfering
OFF (M22).
(10) M24, M25 (chuck barrier ON, OFF)
These M codes set and cancel the chuck barrier which generates an alarm if the tool enters the
area defined by the barrier; chuck barrier ON (M25), chuck barrier OFF (M24).
(11) M26, M27 (thread pitch axis X-axis, Z-axis)
These M codes specify the effective thread pitch axis for conventional thread cutting cycles; X-
axis pitch command (M27), Z-axis pitch command (M26).