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

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

G81 drilling cycle working – G98 G99 return level

CNC Part Program

G81 Drilling Cycle with G98 G99 G code Example 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

TTool no. used.
M06Tool change command.
G90Absolute programming
G00Rapid traverse
SCutter speed
M03Cutter rotation Clockwise
M08Coolant on.
G81Fanuc drilling cycle.
G83Fanuc peck drilling cycle.
G98Return to initial point in canned cycle.
G99Return to R point in canned cycle.
FCutting feed.
G80Canned cycle cancel.
M09Coolant off.
G28Return to reference position.
G91Incremental programming.
M05Cutter rotation stop.
M30CNC part-program end with return to program-start.