G84 G-Code Command
G84 is a standard G-code command used in CNC machining to perform a canned cycle tapping operation. Tapping is a process in which a ‘tapped hole’ is created in a workpiece by cutting threads into it. The G84 command specifies the parameters of the tapping operation, including the feed rate (per rev) and depth of the thread. The command is usually preceded by a G95 command to specify feed rate in revolutions and an M29 to start rigid tap mode along with an ‘S’ value to specify the spindle speed. The exact syntax of the G84 command may vary depending on the CNC machine and software being used.
How G84 G-Code Command Is Used
Here’s an example of a G84 command being used in a G-code program for a tapping operation, with comments in brackets:
T1 M06 (Calls up Tool 1, a 1/4"-20 UNC tap) G90 G00 G54 X3. Y1.5 (rapid move to starting position in X Y) G43 H01 Z2. (rapid move to starting position in Z) M08 (turn on coolant) G95 (Feed Per Rev) M29 S350 (Rigid tap mode and specified RPM) G84 Z-.65 R.1 F.05 (start tapping to depth of -.65" with .1" retract distance) G80 (cancel tapping cycle) G94 (Re-establish feed per minute) G00 Z2. M09 (move to safe height and turn off coolant) G91 G28 X0. Y0. Z0. (send machine to home position) G90 (re-establish absolute movement) M30 (End of Program)
In this example, the G84 command specifies the tapping operation to be performed at the current position (X3.0, Y1.5) with a retract distance of .1″ and a feed rate of .05″ per rev. The feed per rev is calculated by dividing 1″ by the pitch of the tap. In this case a 1/4″-20, so the feed rate will be 1/20, which is .05. The M29 refers to rigid tap mode, although this can vary depending on the machine being programmed. Some machines do not need to use any command other than G84.
The spindle only starts turning when the G84 line is executed, with the spindle reversing direction at the full depth to reverse out of the now tapped hole. The cycle is then cancelled with G80, then G94 re-establishes the machine to feed per minute. Coolant is turned off with the M09 command, and the spindle is sent to the home position.