# Canned cycle

A canned cycle is a way of conveniently performing repetitive CNC machine operations. Canned cycles automate certain machining functions such as drilling, boring, threading, pocketing, etc... Canned cycles are so called because they allow a concise way to program a machine to produce a feature of a part. A canned cycle is also known as a fixed cycle. A canned cycle is usually permanently stored as a pre-program in the machine's controller and cannot be altered by the user.

## Programming format

The operation of a CNC machine tool is typically controlled by a "part program" written a language known as G-code. Canned cycles are similar in concept to functions in a traditional computer language, and can be compared also to G-code macros. The format for a canned cycle consists of a series of parameters specified with a letter and a numerical value. The letter is referred to as an "address". (This use of the term "address" may be unfamiliar to programmers of conventional computers. It arises because in early and primitive machine controllers, the binary representation of the letter formed a physical address at which the controller would store the value following.)
N.. G.. G.. X.. Y.. R.. P.. Q.. I.. J.. Z.. F.. H.. S.. L.. A.. B.. C.. D..
These addresses and values tell the machine where and how to move. The syntax of a canned cycle may vary depending on the brand of the control. In general, the following "words" will be in a canned cycle "block".
* N= Block number
* G98 or G99= Tool retract to R-plane or prior position
* G73, G74, G76, G81-89= The function to perform, for example, G84 specifies a right-hand tapping cycle.
* X= Position of hole or pocket in X axis
* Y= Position of hole or pocket in Y axis
* R= Z axis start position, also known as the retract plane or "R-plane".
* P= Dwell time (in milliseconds, where applicable)
* Q= Depth of each peck (G73, G83) or amount of shift for boring (G76, G87)
* I= Shift amount in X direction
* J= Shift amount in Y direction
* Z= Shift amount in Z direction (Negative because cutting is done in negative Z direction)
* F= Feed rate
* H= Feed rate for finishing cut
* S= Spindle speed
* L= Number of cycle repetitions
* M= Miscellaneous functions
A, B, C and D are used for Rectangular pocket machining.
* A= Machining allowance
* B= Step over
* C= Step depth
* D= Additional depth of cut for first pass
G80 is used for cancelling the currently selected canned cycle as G-codes for canned cycles are modal.
If the machine control supports it, the user may create their own custom canned cycles. As there are numbers not already used for G-codes, new canned cycle programs can be stored at these vacant locations. This may be done on the popular Fanuc control with a technique referred to as "macro programming", after the Fanuc Macro-B language. (The term "Macro programming" in this sense is distinctly different from its more common use to refer to the action of programming a macro in G-code.)
Fanuc controllers (and most others, because Fanuc compatibility is a de facto standard) support the following fixed cycles:
Source: Smid 2008
These are examples used on a mill. Some of them have different functions on a lathe.
| G73 | High speed peck drilling cycle |
| G74 | Left-hand tapping cycle |
| G76 | Precision boring cycle |
| G80 | Cancel any fixed cycle |
| G81 | Drilling cycle |
| G82 | Drilling cycle with dwell |
| G83 | Peck drilling cycle |
| G84 | Right-hand tapping cycle |
| G85 | Boring cycle |
| G86 | Boring cycle |
| G87 | Back boring cycle |
| G88 | Boring cycle |
| G89 | Boring cycle |

### Advantages

The conciseness of canned cycles allows for quicker and easier development of programs at the machine.
As canned cycles reduce the number of blocks in a program, the storage space occupied by the program is less and the programmer escapes the tedium of writing the same instructions again and again. This reduces the potential for errors, and locating any errors that do exist is easier in a shorter program.
Job setup is also facilitated by canned cycles. Some canned cycles exist which are designed for use by machine tool operators for simple job set-up and measuring tasks........