Fanuc Lathe Custom Macro for Peck Drilling

Fanuc Peck Drilling Macro

Move the tool beforehand along the X- and Z-axes to the position where a drilling cycle starts. Specify Z or W for the depth of a hole, K for the depth of a cut, and F for the cutting feedrate to drill the hole.

Following Custom Macro works on Fanuc cnc controls like FANUC Series 30i/31i/32i-MODEL A

Programming

G65 P9100 Z K F

OR

G65 P9100 W K F
ParameterDescription
ZHole depth (absolute programming)
WHole depth (incremental programming)
KCutting amount per cycle
FCutting feedrate

Fanuc Lathe Custom Macro for Peck Drilling

Custom Macro

Main Program

G50 X100.0 Z200.0 ;
G00 X0 Z102.0 S1000 M03 ;
G65 P9100 Z50.0 K20.0 F0.3 ;
G00 X100.0 Z200.0 M05 ;
M30

Macro program

O9100;
#1=0; (Clear the data for the depth of the current hole.)
#2=0; (Clear the data for the depth of the preceding hole.)
IF [#23 NE #0] GOTO 1; (If incremental programming, specifies the jump to N1.)
IF [#26 EQ #0] GOTO 8; (If neither Z nor W is specified, an error occurs.)
#23=#5002-#26;         (Calculates the depth of a hole.)
N1 #1=#1+#6;           (Calculates the depth of the current hole.)
IF [#1 LE #23] GOTO 2; (Determines whether the hole to be cut is too deep?)
#1=#23;                (Clamps at the depth of the current hole.)
N2 G00 W-#2;           (Moves the tool to the depth of the preceding hole at the cutting feedrate.)
G01 W- [#1-#2] F#9;    (Drills the hole.)
G00 W#1;               (Moves the tool to the drilling start point.)
IF [#1 GE #23] GOTO 9; (Checks whether drilling is completed.)
#2=#1;                 (Stores the depth of the current hole.)
N9 M99
N8 #3000=1;            (NOT Z OR U COMMAND Issues an alarm.)