CNC Milling | Canned Cycles

In this article, we describe how to use canned cycles and return height in CNC milling machines with all details and examples. 


Canned Cycles Introduction

Canned cycles are special codes that act like a macro. They are used for hole making and allow one compact block of code to command many moves. For example, a hole can be created using a peck drill cycle with two lines of code  whereas the same move would require maybe twenty or more lines of code if each motion was commanded separately.

G81 Simple Drill Cycle

This cycle makes holes by feeding to depth at a programmed feed rate and then retracting at rapid rate. It is accompanied by G98 or G99, XYZ coordinates, feed rate, and R. R is the feed plane and Z is final depth of the tool tip.

All drill cycles are accompanied by G98 or G99 that determine how high the tool retracts between holes.

G0 Z1. G43 H1
G98 G81 X.5 Y.5 Z-1. R.1 F9.5

For all details about G81 Cycle:
“CNC Milling | G81 Cycle | Drilling”

G82 Spot Drill Cycle

This cycle is identical to G81 except it includes a dwell value, P (in seconds). P is used to pause the tool feed rate at the final depth to create a clean countersink or counterbore finish.

G0 Z1. G43 H1
G98 G82 X.5 Y.5 Z-.0925 P.1 R0.1 F9.5

For all details about G82 Cycle:
“CNC Milling | G82 Cycle | Drilling with Dwell”

G83 Peck Drill

This breaks the chip, clears material out of the hole, and allows coolant to cool the drill and flush out the hole, reducing the chance of the tool breaking and producing a better quality hole. The simplest form of this cycle is shown in Figure 8. Another version of this cycle, called a “deep drill cycle”, uses I,J,K parameters to reduce the amount of peck as the hole gets deeper.

G0 Z1. G43 H1
G83 X.5 Y.5 Z-1.R0.1 Q.25 F9.

For all details about G83 Cycle:
“CNC Milling | G83 Cycle | Peck Drilling”

G84 Tap Cycle

Most modern machines support rigid tapping, which eliminates the need to use special tapping attachments. Rigid tapping precisely coordinates the spindle speed and feed to match the lead of the thread. It then stops and reverses the spindle at the bottom of the cycle to retract the tap. The parameters for the tap cycle are identical to simple drilling (G81).

G0 Z1. G43 H1
G84 X.5 Y.5 Z-1.5 R0.1 F20.

For all details about G84 Cycle:
“CNC Milling | G84 Cycle | Rigid Tapping”


G90 Code (Absolute)

This code commands the machine to interpret coordinates as absolute position moves in the active Work Coordinate System. All programs are written in absolute coordinates.

G90 G0 X1. Y1.

For all details about G90 Code:
“CNC Milling | G90 and G91 Codes | Absolute and Incremental Modes”

G91 Code (Incremental)

This code commands the machine to interpret coordinates as incremental position moves. G91 is used by subprograms but most programming done with CAD/CAM software and does not use subprograms.

The only common use of G91 is in combination with G28 to send the machine back to its home position at the end of the program. The machine must be set back to G90 mode in the next block as a safety measure.

G91 G28 Z0.

For all details about G91 Code:
“CNC Milling | G90 and G91 Codes | Absolute and Incremental Modes”

Return Height in Cycles

G98 Code (Return to Initial Rapid Height)

This code is used in drill cycles to retract the tool to the clearance plane (set in the next previous block) between holes to avoid clamps.

G0 Z1. G43 H1
G98 G81 Z-0.325 R0.1 F12.

Figure 11: G98 (Return to Clearance Plane)

G99 Code (Return to R-Plane)

This code is used in drill cycles to retract the tool to the rapid plane (R) between holes. G99 mode is the machine default and is used when clamp clearance between holes is not an issue.

G0 Z1. G43 H1
G99 G81 Z-0.325 R0.1 F12.

Figure 12: G99 Motion (Return to R-Plane)


Need to More?

Our volunteers have worked together and carefully prepared the articles published here in their native language without using machine translation. You can search the entire site for more information on the subject. You can start a discussion on forums and join us to get support, ask questions, improve a published article or give your opinion.

Previous articleCNC | Machine and Tool Offsets
Next articleCNC Milling | Difference Between 2D – 3D and 4-Axis Machined Parts