CNC Programming Examples - Peck Drilling Lathe

Fanuc G83 Peck Drilling Cycle

G83 peck drilling cycle perform the drilling operation in multiple pecks, this technique makes deep-hole drilling easy and economical.

* Best ebooks for CNC programming: 
CNC Programming Basics 
G-Code and M-Code 
CNC programming 
G-Code Reference 
CNC Machine Tutorial 

Cutting feed is performed intermittently to the bottom of the hole while chips are discharged.
As the drilling is performed to the bottom of the hole with feed in multiple small steps, every time a specified depth is made and then drill retracts, then drill makes the next peck, this operation is repeated again and again until the drill depth is reached.

  • Syntax
  • Usage
  • Working
  • G98 G99 Modes
    • Example
  • Repeat Drilling
  • Working Example


G83 X... Y... Z... R... Q... F... K...
Parameter Description
X Hole position in x-axis.
Y Hole position in y-axis.
Z Depth, tool will travel with feed to Z-depth starting from R plane.
R Position of the R plane.
Q Depth of cut for each cutting feed (Peck).
K Number of cycle repetitions (if required) .
F Feedrate.
Once given in program G83 peck drilling cycle is repeated at every axis movement until G80 is given in program to end peck drilling cycle.


N150 M06 T02
        N160 G90 G00 X60 Y28 Z12 S750 M03
        N170 G99 G83 X60 Y28 Z-17 Q6 R2 F60
        N180 G98 Y12
        N190 G91 G80 G28 X0 Y0 Z0 M05
        N200 M30
In the above example code first drill is done at X60 Y28 and second at Y12 and then peck drilling is cycle is ended with G80.
6mm pecks are taken to complete total drilling depth of 17mm.


Here is briefly described how G83 peck drilling cycle works,
1- Rapid traverse to X, Y drilling position.
2- Rapid traverse to R-plane.
3- Drilling with feed Q deep.
4- Retraction with Rapid traverse to R-plane.
5- Rapid traverse to Q-d deep (d value is specified in parameters).
6- Drilling with feed Q+d deep.
7- Retraction with Rapid traverse to R-plane
– this whole procedure is repeated until drill reaches Z-depth position,
– then drill is retracted to R-plane or Initial-level depends on G99 or G98 which one is given in program.

G83 peck drilling cycle working

G98 G99 Modes

After completing drilling depth the return is made with Rapid feed, the return height can be controlled through using G98 or G99.
G98 Drill will return to the Initial level
G99 Drill will return to R-plane.
G98, G99 can be used multiple times during G83 peck drilling cycle.


N30 G83 X10 Y30 Z-17 Q5 R2 F75
        N40 Y10
        N50 G98 X30
        N60 G99 Y30
        N70 X90
        N80 Y10
        N90 G80

Repeat Drilling

G83 peck drilling cycle, drilling operation can be repeated multiple times. The drilling is repeated K times if K value is given with G83.
Repeat drilling is normally used with G91 Incremental mode, and a good example of repeated drilling is Grid-plate drilling. For working example see G81 drilling cycle.

Working Example

G83 Peck drilling cycle Example
N10 M06 T1
        N20 G90 G00 X12.5 Y10 Z12 S1000 M03
        N30 G99 G83 X12.5 Y10 Z-17 R2 Q4 F75
        N40 Y30
        N50 G98 X57.5
        N60 G99 Y10
        N70 G91 G80 G28 X0 Y0 Z0 M05
        N80 M30


G83 Peck Drilling Cycle Example

CNC programming example code for the G83 Peck Drilling Cycle. G83 deep hole peck drilling cycle makes the drilling of deep holes a breeze.
As with G81 drilling cycle you can do simple drilling in a fast and easy way.
But G83 peck drilling due to its specialty of pecking throws away the chips after every cut or peck and this way also the coolant reaches to the bottom of the hole in a free way, so keeps the drill and component cool and clean.
The following G83 peck drilling cycle example code illustrates the use of peck drilling cycle in an easy to understand way, even the beginner level cnc programmers/cnc machinists will understand the working with ease.
For a complete working of G83 Peck Drilling Cycle read
  • G83 Peck Drilling Cycle (Deep Hole) for Fanuc
  • G83 Peck Drilling Cycle (Deep Hole) for Haas CNC

G83 Peck Drilling Cycle Example Program

G83 Peck Drilling Cycle Example
N1 T1 M06
            N2 G90 G54 G00 X.3 Y.3
            N3 S1200 M03
            N4 G43 H01 Z1. M08
            N5 G83 Z-1.5 Q.5 R.1 F10.
            N6 X1.2 Y1.2
            N7 G80 G00 Z1. M09
            N8 G91 G28 Z0. M05
            N9 M30

G81 Drilling Cycle G83 Peck Drilling with G98 G99 Example Program

A complete cnc part-program which shows how G98 and G99 (canned cycle return level) work with G81 drilling cycle and G83 peck drilling cycle for drilling of a component which have different heights.
  • G98 G99 Summary
  • CNC Part Program
  • Explanation
  • G & M Codes

G98 G99 Summary

G98 and G99 are modal commands that change the way canned cycles (G81,G83 etc.) operate.
When G98 is active, the Z-axis will return to the start position (initial plane) when it completes an single operation.
When G99 is active, the Z-axis will be returned to the R point (plane) when the canned cycle completes a single hole. Then the machine will go to the next hole.

G81 drilling cycle working – G98 G99 return level

CNC Part Program

G81 Drilling Cycle with G98 G99 G code Example Program
N10 M06 T01
                N20 G90 G00 X10 Y30 Z12 S1000 M03
                N30 G99 G81 X10 Y30 Z-17 R2 F75 (Hole 1)
                N40 Y10                         (Hole 2)
                N50 X30                         (Hole 3)
                N60 Y30                         (Hole 4)
                N70 G98 X90                     (Hole 5)
                N80 G99 Y10                     (Hole 6)
                N90 X110                        (Hole 7)
                N100 G98 Y30                     (Hole 8)
                N110 G91 G80 G28 X0 Y0 Z0 M05
                N120 M06 T02
                N130 G90 G00 X60 Y28 Z12 S750 M03
                N140 G99 G83 X60 Y28 Z-17 Q6 R2 F60  (Hole 9)
                N150 G98 Y12                         (Hole 10)
                N160 G91 G80 G28 X0 Y0 Z0 M05
                N170 M30


N10- Tool change (M06) to tool no.1
N20- Rapid traverse to X10 Y30 Z12, Spindle started clockwise (M03) with 1000rpm (S1000).
N30- Drilling starts (G81) at X10 Y30 with cutting-feed (F75) drill will retract to R-plane after drilling operation.
N40- Next drilling position Y10 (as G99 is a modal g-code drill will keep on retracting to R-plane until G98 is given).
N50- Next drill at X30.
N60- Drill at Y30
N70- Drill at X90 & Retract to Initial-plane.
N80- Drill at Y10 & Retract to R-plane.
N90- Drill at X110
N100- Drill at Y30 & Retract to Initial-plane.
N110-  Drilling cycle is cancelled (G80), return to reference point (G28) for tool change, stop spindle (M05).
N120- Tool change (M06) to tool number 2.
N130- Rapid traverse to X60 Y28 Z12, start spindle at 750rpm (S750) clockwise (M03).
N140- G83 Peck drilling starts at X60 Y28, drill depth is Z-17 and drill peck size is Q6, drilling feed is F60
N150- Next deep drill at Y12 (return to initial point).
N160- G83 Peck drilling cycle cancelled with G80, tool returned to reference point (G28), spindle stopped (M05).
N170- Part-program end with return to program start (M30)

G & M Codes

Code Description
T Tool no. used.
M06 Tool change command.
G90 Absolute programming
G00 Rapid traverse
S Cutter speed
M03 Cutter rotation Clockwise
M08 Coolant on.
G81 Fanuc drilling cycle.
G83 Fanuc peck drilling cycle.
G98 Return to initial point in canned cycle.
G99 Return to R point in canned cycle.
F Cutting feed.
G80 Canned cycle cancel.
M09 Coolant off.
G28 Return to reference position.
G91 Incremental programming.
M05 Cutter rotation stop.
M30 CNC part-program end with return to program-start.