From G73 and G83 peck cycles to Fanuc Macro B, Siemens CYCLE83, and continuous-feed gundrilling and BTA programming. Peck-depth rules, dwell, chip breaking, complete working G-code examples, and the custom macros that take over beyond 8×D.
30-Second Summary: Standard peck cycles (G73 chip-break, G83 chip-clear) are reliable to roughly 8× drill diameter (L/D 8:1). Beyond that you need progressively decreasing peck depths, a custom macro, or a switch to continuous-feed deep hole drilling (gundrilling or BTA). Choosing the wrong cycle either wastes cycle time or risks breaking the tool. On dedicated gundrill and BTA machines the tool feeds continuously — pecking is primarily a machining-center technique for carbide deep hole drills.
Match the cycle to the L/D ratio before you write a single line of G-code:
| Code | Name | Retract Behavior | Best For | Practical Depth Limit |
|---|---|---|---|---|
| G81 | Standard / plain drill | No peck — continuous feed in, rapid out | Shallow holes, spot drills, through-holes ≤ 3×D | < 3×D |
| G73 | High-speed peck (chip break) | Short retract of the chip-break distance d inside the hole | Moderate depths, ductile materials that make stringy chips | ~4.5×D |
| G83 | Full-retract peck (deep hole) | Full retract to the R-plane each peck | Deep holes needing complete chip evacuation | ~8×D (to 12×D with careful peck sizing) |
| G74 | End-face peck drill (lathe) | Short retract R per peck along Z | Deep Z-axis drilling on turning centers | < 8×D |
| G85 | Boring / feed-out cycle | Feed to depth, feed back out — no rapid retract | Reaming and boring where a power-feed retract avoids drag marks | — |
G85 earns a mention in deep-hole work because its feed-out retract prevents the tool from scoring the bore wall on withdrawal — useful for a finishing pass after peck drilling. It is a modal cycle, canceled with G80, like the rest.
G81 X_ Y_ Z_ R_ F_ (plain drill - no peck) G73 X_ Y_ Z_ R_ Q_ F_ (high-speed peck - Q = peck depth, short retract) G83 X_ Y_ Z_ R_ Q_ P_ F_ K_ (deep hole peck - Q = peck, P = dwell at bottom, K = repeats) G74 R(e); G74 Z_ Q_ F_ (lathe end-face peck - Q in microns, R = retract per peck) G85 X_ Y_ Z_ R_ F_ (boring - feed in, feed out)
G83 rapids to the position, rapids to the R-plane, feeds to depth Q, then rapid-retracts all the way to the R-plane. On the next stroke it rapids back down to a point Q − d (one chip-break clearance above the previous bottom), then feeds the remaining d plus the next full peck:
G98 G83 Z-200. R3. Q20. P0.5 F120. 1. Rapid to X,Y 2. Rapid to R3.0 3. Feed to -20.0 4. Rapid to R3.0 5. Rapid to -19.9 (Q-d) 6. Feed to -40.0 ... repeat to Z-200., dwell P0.5, then G98 rapid to the initial plane
| L/D Ratio | Recommended Initial Peck Depth | Recommended Cycle | Notes |
|---|---|---|---|
| 3:1–5:1 | 1.5–2.0 × D | G83 | Standard peck cycle is sufficient |
| 5:1–8:1 | 1.0–1.5 × D | G83 | Reduce feed by 20% |
| 8:1–12:1 | 0.5–1.0 × D | G83 or custom macro | Progressive decrease recommended |
| 12:1–20:1 | 0.3–0.5 × D, decreasing with depth | Custom macro | Use a pilot hole; feed reduction factor 0.6× |
| > 20:1 | 0.2–0.3 × D, decreasing progressively | Custom macro only | Pilot hole required; reduction factor 0.5× |
O1000 (G83 PECK DRILL - 20MM DRILL, 200MM DEEP, L/D 10:1) N10 G21 G40 G80 G90 (metric, cancel canned cycles) N20 G54 G0 X50. Y50. (hole position) N30 S900 M03 N40 G43 H01 Z20. M08 (tool length comp, coolant on) N50 G98 G83 Z-200. R3. Q20. P0.5 F120. N60 G80 (cancel the cycle) N70 G0 Z100. M09 N80 M05 N90 M30
For holes exceeding 8×D on Fanuc-controlled machining centers, this custom macro progressively reduces peck depth as the hole deepens. Note the correct Macro B convention: square brackets for arithmetic, parentheses for comments.
O9001 (DEEP HOLE MACRO - FANUC MACRO B) (CALL: G65 P9001 Z_ Q_ R_ T_ I_ F_) #26 = Z final depth (absolute) #17 = Initial peck depth Q (mm) #18 = Minimum peck depth R (mm) #20 = Dwell at bottom T (seconds) #4 = Decrease rate I (0.1 = 10% per peck) #9 = Feed rate F (mm/min) #100 = #5043 (current Z position) #101 = #100 - #17 (first peck target) #102 = #17 (current peck depth) WHILE [#101 GT #26] DO1 G01 Z#101 F#9 G00 Z#100 (retract to previous safe Z) #100 = #101 (update safe Z) #102 = #102 * [1 - #4] (reduce peck depth) IF [#102 LT #18] THEN #102 = #18 (clamp to minimum) #101 = #101 - #102 (next peck target) IF [#101 LT #26] THEN #101 = #26 (don't overshoot final depth) END1 G01 Z#26 F#9 (final depth) G04 P#20 (dwell at the bottom) G00 Z[#5043] (retract to initial plane) M99
Call it for a 20 mm drill, 400 mm deep (20:1) — 15 mm initial peck, 10% reduction per peck, 3 mm minimum, 0.5 s dwell:
G65 P9001 Z-400. Q15. R3. T0.5 I0.1 F120.
On Fanuc lathes, G74 is the end-face peck drilling cycle (it doubles as face grooving when X and P are added). It is programmed in two blocks, and the Q value is entered in microns without a decimal point:
G74 R(e); (e = retract distance per peck, mm - modal) G74 Z(W) Q(delta-k) F(f); (Z = final depth, Q = peck in microns, F = mm/rev)
O2000 (G74 END-FACE PECK DRILL ON LATHE) N10 G21 G97 S750 M03 N20 G0 X0. Z3. N30 G74 R1.0 (retract 1 mm per peck) N40 G74 Z-50. Q10000 F0.05 (Q10000 = 10 mm peck, F = 0.05 mm/rev) N50 G0 Z50. M05 N60 M30
Siemens controls use CYCLE83 for deep hole drilling with a comprehensive parameter set — progressive peck reduction, dwell at depth and at retract, and a feed-rate factor:
CYCLE83(RTP, RFP, SDIS, DP, DPR, FDEP, FDPR, DAM, DTB, DTS, FRF, VARI)
| Parameter | Meaning | Example Value |
|---|---|---|
| RTP | Retract plane (absolute) | Z = 2.0 |
| RFP | Reference plane (absolute) | Z = 0.0 |
| SDIS | Safety clearance | 1.0 |
| DP | Final depth (absolute) | Z = -100.0 |
| DPR | Final depth (relative to RFP) | 100.0 |
| FDEP | First peck depth | 15.0 |
| FDPR | First peck depth (relative) | — |
| DAM | Subsequent peck depth (reduction amount) | 2.0 |
| DTB | Dwell at depth (seconds) | 0.5 |
| DTS | Dwell at start of retract (seconds) | 0.0 |
| FRF | Feed-rate factor for first peck | 0.8 |
| VARI | Operation mode (0 = chip break, 1 = full retract) | 1 |
Heidenhain controls offer Cycle 241 specifically for single-lip deep hole drilling (gundrilling), with programmable spindle-speed reduction and coolant control:
CYCL DEF 241 SINGLE-LIP DEEP HOLE DRILLING Q200 = +2 ;SET-UP CLEARANCE Q201 = -400 ;DEPTH Q206 = +120 ;FEED RATE FOR PLUNGING Q211 = +0.5 ;DWELL TIME AT DEPTH Q203 = +0 ;SURFACE COORDINATE Q204 = +50 ;2ND SET-UP CLEARANCE Q208 = +300 ;RETRACTION FEED RATE Q256 = +20 ;STARTING ANGLE Q257 = +0 ;ANGLE INCREMENT
Cycle 205 (Universal Pecking) provides variable peck depth with chip breaking, suitable for deep hole drilling on machining centers. Q parameters control the initial and subsequent peck depths, dwell time, and feed-rate reduction — the Heidenhain answer to the Fanuc progressive-macro problem, built in.
Gundrilling uses a single-lip tool that evacuates chips through a V-shaped groove, driven by high-pressure coolant delivered through a hole inside the tool. On a dedicated gundrill machine the tool feeds continuously with no pecking, and it retracts immediately at the bottom — no dwell, to avoid leaving dwell marks. On a machining center, gundrilling works only if the machine has through-spindle high-pressure coolant; external flood coolant cannot reach the cutting zone in a deep hole.
O3000 (GUNDRILL - CONTINUOUS FEED, THROUGH-SPINDLE COOLANT) N10 G21 G40 G80 G90 N20 G54 G0 X0. Y0. N30 S1500 M03 N40 M08 (high-pressure through-spindle coolant ON) N50 G43 H01 Z3. N60 G1 Z-400. F180. (single continuous feed - no peck, no dwell) N70 G0 Z150. M09 (retract immediately at the bottom) N80 M05 N90 M30
For through-holes, feed 20–30% of the diameter past the far wall so the tip fully breaks through.
BTA drilling is a continuous-feed process — the hole is cut in one pass and chips are evacuated through the tool (Single Tube System, STS) back to the chip box. There is no pecking. Program it as a single feed move with high-pressure coolant; the real work is sizing the machine settings for the hole diameter.
O4000 (BTA STS - CONTINUOUS FEED ON CNC LATHE) N10 G21 G97 S250 M03 N20 G0 X0. Z2. N30 M08 (high-pressure coolant ON, typically 50-100 bar) N40 G1 Z-800. F0.1 (single continuous feed - F in mm/rev) N50 G0 Z150. M09 (retract at the bottom, no dwell) N60 M05 N70 M30
| Reference setting (ISCAR STS guide) | Value | Notes |
|---|---|---|
| Cutting speed Vc | ~250 SFM (~76 m/min) | Lower for the Double Tube System ejector (~230 SFM) |
| Feed rate | ~0.006–0.010 IPR (0.15–0.25 mm/rev) | Continuous, scaled to tool diameter |
| Coolant pressure | up to ~1450 PSI (~100 bar) | Drives chip evacuation through the tube |
| Net power / feed force | charted vs. diameter (0.6–1.1″: 1.3–10.7 HP; feed force to ~1800 lbf) | Use the toolmaker’s charts, not guesses |
Built-in cycles have limits — for example, drilling deep holes in malleable materials needs a combination of chip breaking and chip clearing that no single canned cycle provides. Custom macros solve this. This lathe macro (O9011) binds to a user-defined G-code (G174 via parameter 6051) and includes error trapping so a bad call alarms instead of cutting air:
O9011 (LATHE DEEP-HOLE MACRO - BIND TO G174 VIA PARAM 6051) (CALL: G65 P9011 Z_ Q_ F_ OR G174 Z_ Q_ F_) #26 = Z final depth (abs) #17 = Q peck (microns) #9 = feedrate IF [#17 EQ #0] THEN #3000 = 100 (PECK LENGTH NOT SPECIFIED) IF [#26 EQ #0] THEN #3000 = 101 (DEPTH NOT SPECIFIED) #17 = #17 / 1000. (microns to mm) #100 = #5002 (current Z position) #101 = #100 - #17 (first peck target) WHILE [#101 GT #26] DO1 G1 Z#101 F#9 G0 Z#100 (retract to the start of the last peck) #100 = #101 #101 = #101 - #17 IF [#101 LT #26] THEN #101 = #26 (clamp final peck) END1 G1 Z#26 F#9 G0 Z#5002 (retract to start) M99
A combined macro uses an outer WHILE loop for chip clearing (full retract to the R-plane) and an inner WHILE loop for chip breaking (small retracts) inside each clearing peck. It reuses the standard G83 words plus a V address for the chip-break distance, called modally with G66.1:
G66.1 P9010 X1.0 Y1.0 Z-3.25 R0.1 Q1.0 V0.1 F5.0 X2.0 (second hole position - macro still active) X3.0 G67 (cancel the modal macro call)
IF [#24 NE #0] THEN #101 = #24), so previously specified values persist across multiple hole positions — just like a built-in canned cycle.| Controller | Primary Deep Hole Cycle | Key Features |
|---|---|---|
| Fanuc / Haas | G83 (standard), G73 (chip break) Macro B custom cycles for L/D > 12:1 | Modifiable with custom macros; Q parameter for peck depth; variable retract amounts |
| Heidenhain | Cycle 241 (single-lip) Cycle 205 (universal pecking) | Single-lip specific with speed control; programmable spindle reduction; coolant on/off per step |
| Siemens Sinumerik | CYCLE83 | Comprehensive parameter set; progressive peck reduction; dwell at depth and retract; feed-rate factor |
| Mazak (Mazatrol) | M+ / M- codes integrated in the drilling unit | Conversational programming; deep hole parameters in the drilling unit setup |
| Okuma (OSP) | M-codes with custom macro variables | Custom macro with deep hole drilling canned-cycle options |
#102 = #102 * [1 - #4], not (1 - #4).