M04

From CNC.xyz Wiki
Jump to: navigation, search

For CNC machines equipped with a remote activated spindle, the M04 M-Command will activate the spindle in the counter clock-wise direction, also known as Spindle Reverse. For CNC machines with a pulse width modulated (PWM) spindle, an additional parameter will set the speed, typically calculated in RPM.

It is very important to issue a spindle stop command M05 prior to activating the spindle reverse code. An appropriate G04 dwell command should be used to allow a previously running spindle enough time to slow down and come to a stop. Likewise it is important to issue a dwell command after the spindle has been turned on, to ensure it has enough time to get up to full speed.

Standard Format:
M04 S00000

The S parameter represents the desired speed. Omit the S command if there is no PWM spindle available, it is not required.

Code Examples

In this example, the spindle will be turned on clockwise, run for 10 seconds and then turn off with command M05. After a 5 second wait, we will activate the spindle reverse run for 5 seconds and then come to a stop.

M03
G04 P10.000
M05
G04 P5.000
M04
G04 P5
M05

For spindles with a PWM speed control, this example will turn the spindle on and set the speed to 12000 rpm. A G04 dwell command is added to ensure it gets up to speed.

M04 S12000
G04 P5.000