For
CAD/CAM
and
Engineering Technology
Students
Computer Numerical Programming for
Fanuc 18i & 21i
and
Anilam 5000 series
Controllers
Course Codes
MET406 and CAM420
2
Revised August 2005 by Brian LaBombard
TABLE OF CONTENTS
TOPIC:
PAGE:
3
Revised August 2005 by Brian LaBombard
4
Revised August 2005 by Brian LaBombard
5
Revised August 2005 by Brian LaBombard
6
Revised August 2005 by Brian LaBombard
7
Revised August 2005 by Brian LaBombard
8
Revised August 2005 by Brian LaBombard
O word
Explanations
%
(TITLE) ;
O0001 ... ;
..
..
..
N0025..
(COMMENT)
[COMMENT]
..
..
N0050 M30 or M2;
O0002 ;
..
..
..
N0050 M99;
Fanuc ONLY %
End of Data
Data Start
The program start is identified by a percent sign (%) and indicates the
start of a file that contains NC program(s).
Leader Section
Program Start
Program End
Data End
9
Revised August 2005 by Brian LaBombard
In the example shown here, the lower left corner is the origin of all programming dimensions.
INCREMENTAL:
When a G91 command is entered in a program block, all further movements are performed as an incremental
value. When the dimensions for each hole, or part configuration position, are indicated by the pitch or distance
from one to the next, we are said to be in incremental mode. This code is modal.
In the example shown here, the pitch from one to the next indicates the holes position.
10
Revised August 2005 by Brian LaBombard
Workpiece
Coordinate system
Number 2
Workpiece
Coordinate system
Number 3
Workpiece
Coordinate system
Number 4
Workpiece
Coordinate system
Number 5
EXOFS
Workpiece
Coordinate system
Number 6
The syntax used of the Anilam 5500M controller is as follows; G53 O3, where O3 represents a memory
register that contains the distance from machine home to the program origin. Anilam has 99 such offsets. No
movement takes place on this line. It must be followed by an X and Y move to active the offset.
Example
Fanuc
N10 G54 X__ Y__ Z__ M3 S1200 (G54 - establishes the program origin relative to the machine home
position on all 3 axes, M3 sets the spindle rotation to clockwise, S1200 set the spindle speed to 1200R.P.M.'s )
Anilam
N25 G53 O1 (Activates Fixture Offset number 1 which locates the part from the machines HOME position)
N30 X__ Y____M3 S_____ (Move to a position and start spindle in clockwise direction at a specified
R.P.M.)
11
Revised August 2005 by Brian LaBombard
LINEAR INTERPOLATION
(G00 AND G01)
Rapid Traverse Positioning: (G00 or G0)
Positioning is done in the rapid traverse mode using the following command in a program line or block.
G0 X..... Y..... Z.....; (the colon (;) indicates a line feed (LF) plus a carriage return(CR))
With this command, up to 3 axes can be controlled simultaneously.
The tool path is linear from the start point to the end point, thus, the name linear interpolation rapid.
A typical G00 (rapid) move
End Point
450
Start Point
X, Y and Z are final point coordinate values and may be designated in either incremental or absolute. The
feedrate is controlled by a preset rapid traverse in the range of 150 to 1100 i.p.m. depending on the machine
tool.
G00, G90 and G91 commands are modal under most conditions.
Feed Rate Positioning: (G01 or G1)
This positioning is done using a G code and a feedrate code (F). These 2 codes are said to be associative.
e.g.
G1 X..... Y..... Z..... F...(F indicates the rate of feed in inches/min. of m.m./min.)
This command is for linear interpolation by cutting feed and up to 3 axes can be controlled simultaneously.
12
Revised August 2005 by Brian LaBombard
LINEAR INTERPOLATION
(G00 AND G01)
Listed below are 2 examples of linear interpolation using the G00 and G01 commands.
Here is an example of a simple XY linear Interpolation move.
(G91) G01 X150.0 Y100.0 F200.0
Y axis
100.00
(End point)
X axis
0, 0 (Start point)
150.00
(Start point)
900
(End point)
13
Revised August 2005 by Brian LaBombard
14
Revised August 2005 by Brian LaBombard
Program closing
N155 G0 Z.5 M5 (Raise Z axis above the part and turn off spindle)
N160 X____ Y_____ (Move to a position to unload part, e.g. X-3. Y3.)
N165 G53 O0 (Cancels Fixture Offsets)
N170 T0 Z0 M9 (return Z to tool change position and turn off water)
N175 M2 (end of program cycle)
15
Revised August 2005 by Brian LaBombard
G03
G03
G02
G03
G02
G02
G17
Y
G19
End
End
Start
End
Start
J
Arc Center
G18
Start
I
Arc Center
K
Arc Center
Selection of the arc plane is done by using the G17-G19 commands and then programming the arc using the
correct X, Y, or Z axes. Also using the standard F command can perform the selection of the feed rate; however
the modal feedrates established by G01 are also valid.
It is possible to designate arcs larger than 90 degrees or 1 quadrant in a program line. Full circles can be
machined as easily as the examples shown below. A full circle cannot be accomplished with the 'R' address.
G2/G3 X0Y0I1.
G2/G3 J2.
16
Revised August 2005 by Brian LaBombard
Here is a typical program line for performing a simple arc movement in the absolute mode.
17
Revised August 2005 by Brian LaBombard
The use of the address R for radius can be specified with an R or R- to develop arcs larger than 180 degrees.
This syntax is explained below.
ARC 1 less than 1800.
G91 G2 X45.0 Y35.0 R50.0 F300.0
End point
50 mm radius
R- uses this center
50 mm radius
Start point
Start point
18
Revised August 2005 by Brian LaBombard
End point
NOTE: The controller when calculating its tool position, creates a positioning vector. This vector is equal to
the value of the offset,(e.g. D5=.25) and is created at 90 deg. to the next programmed G0, G1, G2 or G3 X
and Y movement direction in the program. The controller moves the centre of the cutting tool to the end of the
vector during a programmed 'dummy move' move. Once tool radius compensation is engaged it remains modal
until a G40 with an X and/or Y move cancels compensation.
19
Revised August 2005 by Brian LaBombard
NOTES:
1. In the absence of X and Y on the G41/G42 line no movement occurs until a following block provides
movement. Therefore no compensation is established until a movement occurs.
2. The start-up and cancellation of tool radius compensation CANNOT be executed on a program line
where G2 or G3 are modal. Starting or cancelling compensation must be programmed using a modal
G0 or G1. Once compensation is established arcs are cut automatically with the tool offset as described
below.
20
Revised August 2005 by Brian LaBombard
21
Revised August 2005 by Brian LaBombard
G91/G90
G0 G43 Z25. H11
G0 G43 Z25. H15
G0 G43 Z25. H31
Tool length comp. movements are the same for G90 or G91
H11 = 200
H15 = 190
H31 = 150
In the above examples the amount of movement of the Z axis would be different each time using the offset
values to the right, however each tool would arrive at a position 25.0 mm above the part surface.
Tool length compensation can ONLY be used during G0 or G1 machine movements NOT G2 or G3
23
Revised August 2005 by Brian LaBombard
24
Revised August 2005 by Brian LaBombard
Plane Selection
Drilling Axis
The term drilling will be used to define all the machining performed by
these canned cycles which include tapping, boring, counterboring,
countersinking etc.
The drilling axis is any basic axis (X, Y, or Z) that is not considered a
positioning axis and is commanded in the same program line as the
drilling G code (G73, G74, G76, G81 G89)
25
Revised August 2005 by Brian LaBombard
The travel distance along the drilling axis varies from G90 and G91 as
follows.
Drilling Mode
G73, G74, G76, and G81 to G89 are modal G codes and remain in
effect until cancelled. When any of these G codes are in effect, the
current state is the drilling mode. Once drilling data is specified in the
drilling mode, the data is retained; until modified or cancelled.
Specify all necessary drilling data at the beginning of canned cycles;
when canned cycles are being performed, specify data modifications
only
26
Revised August 2005 by Brian LaBombard
When the tool reaches the bottom of a hole, the tool may be returned to
the point R or the initial level. These operations are specified with G98
and G99. The following illustrates how the tool moves when G98 and
G99 is specified. Generally, G99 is used for the first drilling operation
and G98 is used for the last drilling operation.
The initial level does not change even when drilling is performed in the
G99 mode.
Repeat
Cancel
27
Revised August 2005 by Brian LaBombard
Syntax
28
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled using G80.
Drilling
Q/P
Cancel
Tool Offset
Example
M3 S2000;
start spindle
G90 G99 G73 X300. Y-250. Z-150. R-100. Q15. F120.
Position to/drill hole 1 and return to point R
Y-550.
Position to/drill hole 2 and return to point R
Y-750.
Position to/drill hole 2 and return to point R
X-1000.
Position to/drill hole 2 and return to point R
Y-550.
Position to/drill hole 2 and return to point R
G98 Y-750.
Position to/drill hole 2 and return to point R
G80 G28 G91 X0 Y0 Z0 M5 Return to Machine Home and stop
spindle
29
Revised August 2005 by Brian LaBombard
Syntax
Explanations
30
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Drilling
Cancel
Tool Offset
Examples
M4 S100
start spindle counterclockwise
G90 G99 G74 X300. Y-250. Z-150. R-120. F120.
Position, tap hole 1 and return to point R
Y-550.
Position, tap hole 2 and return to point R
Y-750.
Position, tap hole 3 and return to point R
X1000.
Position, tap hole 4 and return to point R
Y-550.
Position, tap hole 5 and return to point R
G98 Y-750.
Position, tap hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel drilling cycle and return to
machine-home position in incremental
M5
Stop spindle
31
Revised August 2005 by Brian LaBombard
The fine boring cycle bores a hole precisely. When the bottom of the
hole is reached, the spindle stops and the tool is moved away from the
machined surface of the workpiece and retracted.
Syntax
32
Revised August 2005 by Brian LaBombard
When the bottom of the hole is reached the spindle is stopped at the
fixed rotation position and the tool is moved in the direction opposite to
the tool tip and retracted. This ensures that the machined surface is not
damaged and enables precise and efficient boring to be performed.
Before specifying G76 start the spindle with an M code (M3).
When the G76 command and an M code are executed in the same block,
the M code is executed at the time of the first positioning operation. The
system then proceeds to the next operation.
When K is used to specify the number of repeats, the M code is executed
for the first hole only. For the remaining holes the M code is not
executed.
When tool length offset (G43, G44 or G49) is specified in the canned
cycle, the offset is applied at the time of positioning to point R.
Limitations
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Boring
P/Q
Cancel
Tool offset
Examples
M3 S500
start spindle clockwise
G90 G99 G76 X300. Y-250. Z-150. R-120. Q5.
Position, bore hole 1, return to point R,
orient at hole bottom, then shift 5mm.
P1000 F120.
Stop at bottom of hole for 1 second.
Y-550.
Position, bore hole 2 and return to point R
Y-750.
Position, bore hole 3 and return to point R
X1000.
Position, bore hole 4 and return to point R
Y-550.
Position, bore hole 5 and return to point R
G98 Y-750.
Position, bore hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel drilling cycle and return to machinehome position in incremental
M5
Stop spindle
33
Revised August 2005 by Brian LaBombard
This cycle is used for regular drilling. Cutting feed is performed to the
bottom of the hole. After rapid positioning along the X and Y axes, rapid
traverse continues along Z to point R.
Syntax
Explanation
34
Revised August 2005 by Brian LaBombard
Axis Switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Drilling
Cancel
Tool Offset
Example
M3 S500
start spindle counterclockwise
G90 G99 G81 X300. Y-250. Z-150. R-100. F120.
Position, drill hole 1, return to point R,
Y-550.
Position, drill hole 2 and return to point R
Y-750.
Position, drill hole 3 and return to point R
X1000.
Position, drill hole 4 and return to point R
Y-550.
Position, drill hole 5 and return to point R
G98 Y-750.
Position, drill hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel drilling cycle and return to machinehome position in incremental
M5
Stop spindle
35
Revised August 2005 by Brian LaBombard
Syntax
Explanation
36
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Boring
Cancel
Tool offset
Example
M3 S500
start spindle counterclockwise
G90 G99 G82 X300. Y-250. Z-150. R-100. P1000 F120.
Position, drill hole 1, dwell for 1 second at
bottom of the hole, then return to point R,
Y-550.
Position, drill hole 2 and return to point R
Y-750.
Position, drill hole 3 and return to point R
X1000.
Position, drill hole 4 and return to point R
Y-550.
Position, drill hole 5 and return to point R
G98 Y-750.
Position, drill hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel drilling cycle and return to machinehome position in incremental
M5
Stop spindle
37
Revised August 2005 by Brian LaBombard
Syntax
Explanation
Q represents the depth of the cut for each cutting feed (peck). It must
always be specified as and incremental value.
In the second and subsequent cutting feeds, rapid traverse is performed
up to a d point just before where the last drilling ended and cutting feed
is performed again (d is set by parameter).
Q must be set to a positive value. However, negative values are ignored.
Before specifying G83, start the spindle with an M code (M3).
When the G83 command and an M code are specified in the same block
the M code is executed at the time of the first positioning operation. The
system then proceeds to the next drilling operation.
When K is used to specify the number of repeats, the M code is executed
on the first hole and the spindle stays running throughout the sequence.
When tool length offset (G43, G44 or G49) are specified in the canned
cycle, the offset is applied at the time of the positioning to point R.
38
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Boring
Cancel
Tool offset
Example
M3 S500
start spindle counterclockwise
G90 G99 G83 X300. Y-250. Z-150. R-100. Q15. F120.
Position, drill hole 1, dwell for 1 second at
bottom of the hole, then return to point R,
Y-550.
Position, drill hole 2 and return to point R
Y-750.
Position, drill hole 3 and return to point R
X1000.
Position, drill hole 4 and return to point R
Y-550.
Position, drill hole 5 and return to point R
G98 Y-750.
Position, drill hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel drilling cycle and return to machinehome position in incremental
M5
Stop spindle
39
Revised August 2005 by Brian LaBombard
Syntax
Explanations
40
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Drilling
Cancel
Tool Offset
Example
M3 S100
start spindle counterclockwise
G90 G99 G84 X300. Y-250. Z-150. R-120. P300 F120.
Position, tap hole 1 and return to point R
Y-550.
Position, tap hole 2 and return to point R
Y-750.
Position, tap hole 3 and return to point R
X1000.
Position, tap hole 4 and return to point R
Y-550.
Position, tap hole 5 and return to point R
G98 Y-750.
Position, tap hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel drilling cycle and return to
machine-home position in incremental
M5
Stop spindle
41
Revised August 2005 by Brian LaBombard
Syntax
Explanation
42
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Boring
Cancel
Tool offset
Example
M3 S100
start spindle clockwise
G90 G99 G85 X300. Y-250. Z-150. R-120. F120.
Position, bore hole 1, return to point R,
Y-550.
Position, bore hole 2 and return to point R
Y-750.
Position, bore hole 3 and return to point R
X1000.
Position, bore hole 4 and return to point R
Y-550.
Position, bore hole 5 and return to point R
G98 Y-750.
Position, bore hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel boring cycle and return to machinehome position in incremental
M5
Stop spindle
43
Revised August 2005 by Brian LaBombard
Syntax
Explanation
44
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Boring
Cancel
Tool offset
Example
M3 S100
start spindle clockwise
G90 G99 G86 X300. Y-250. Z-150. R-120. F120.
Position, bore hole 1, return to point R,
Y-550.
Position, bore hole 2 and return to point R
Y-750.
Position, bore hole 3 and return to point R
X1000.
Position, bore hole 4 and return to point R
Y-550.
Position, bore hole 5 and return to point R
G98 Y-750.
Position, bore hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel boring cycle and return to machinehome position in incremental
M5
Stop spindle
45
Revised August 2005 by Brian LaBombard
Syntax
Explanation
After positioning along the X and Y axes the spindle is stopped at the
fixed rotation position (spindle orientation position). The tool is moved
in the direction opposite to the tool tip; positioning
(rapid traverse) is performed to the bottom of the hole (point R).
The tool is then shifted in the direction of the tool tip and the spindle is
rotated clockwise. Boring is performed in the positive direction along
the Z axis until point Z is reached.
At point Z the spindle is stopped at the fixed rotation position again, the
tool is shifted in the direction opposite to the tool tip, and then the tool is
returned to the initial level. The tool is then shifted in the direction of the
tool tip and the spindle is rotated clockwise to proceed to the next block
operation.
Before specifying G87 start the spindle with an M code (M3).
When the G87 command and an M code are executed in the same block,
the M code is executed at the time of the first positioning operation. The
system then proceeds to the next operation.
When K is used to specify the number of repeats, the M code is executed
for the first hole only. For the remaining holes the M code is not
executed.
When tool length offset (G43, G44 or G49) is specified in the canned
cycle, the offset is applied at the time of positioning to point R.
46
Revised August 2005 by Brian LaBombard
Axis switching
Boring
P/Q
Cancel
Tool offset
Examples
Before the drilling axis can be changed, the canned cycle must be
cancelled.
M3 S500
start spindle clockwise
G90 G99 G87 X300. Y-250. Z-150. R-150. Q5.
Position, bore hole 1, orient at initial level,
then shift 5mm.
P1000 F120.
Stop at bottom of hole for 1 second.
Y-550.
Position, bore hole 2
Y-750.
Position, bore hole 3
X1000.
Position, bore hole 4
Y-550.
Position, bore hole 5
G98 Y-750.
Position, bore hole 6
G80 G28 G91 X0 Y0 Z0 Cancel drilling cycle and return to machinehome position in incremental
M5
Stop spindle
47
Revised August 2005 by Brian LaBombard
Syntax
Explanation
48
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Boring
Cancel
Tool offset
Example
M3 S2000
start spindle clockwise
G90 G99 G88 X300. Y-250. Z-150. R-100. P1000 F120.
Position, bore hole 1, return to point R,
Y-550.
Position, bore hole 2 and return to point R
Y-750.
Position, bore hole 3 and return to point R
X1000.
Position, bore hole 4 and return to point R
Y-550.
Position, bore hole 5 and return to point R
G98 Y-750.
Position, bore hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel boring cycle and return to machinehome position in incremental
M5
Stop spindle
49
Revised August 2005 by Brian LaBombard
Syntax
Explanation
This cycle is the same as G85. The difference is that this cycle performs
a dwell at the bottom of the hole.
Before specifying G89 use an M code to turn on the spindle (M3).
When the G89 command and an M code are specified in the same block,
the M code is executed at the time of the first positioning operation. The
system then proceeds to the next drilling operation. When K is used to
specify the number of repeats, the M code is executed for the first hole
only; for the second and subsequent holes, the M code is not executed.
When a tool length offset (G43, G44 or G49) is specified in the canned
cycle, the offset is applied at the time of the positioning to point R.
50
Revised August 2005 by Brian LaBombard
Axis switching
Before the drilling axis can be changed, the canned cycle must be
cancelled.
Boring
Cancel
Tool offset
Example
M3 S2000
start spindle clockwise
G90 G99 G89 X300. Y-250. Z-150. R-120. P1000 F120.
Position, bore hole 1, return to point R,
Y-550.
Position, bore hole 2 and return to point R
Y-750.
Position, bore hole 3 and return to point R
X1000.
Position, bore hole 4 and return to point R
Y-550.
Position, bore hole 5 and return to point R
G98 Y-750.
Position, bore hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel boring cycle and return to machinehome position in incremental
M5
Stop spindle
51
Revised August 2005 by Brian LaBombard
Syntax
G80
Example
M3 S2000
start spindle clockwise
G90 G99 G89 X300. Y-250. Z-150. R-120. P1000 F120.
Position, bore hole 1, return to point R,
Y-550.
Position, bore hole 2 and return to point R
Y-750.
Position, bore hole 3 and return to point R
X1000.
Position, bore hole 4 and return to point R
Y-550.
Position, bore hole 5 and return to point R
G98 Y-750.
Position, bore hole 6 and return to initial
level
G80 G28 G91 X0 Y0 Z0 Cancel boring cycle and return to machinehome position in incremental
M5
Stop spindle
52
Revised August 2005 by Brian LaBombard
53
Revised August 2005 by Brian LaBombard
54
Revised August 2005 by Brian LaBombard
55
Revised August 2005 by Brian LaBombard
56
Revised August 2005 by Brian LaBombard
57
Revised August 2005 by Brian LaBombard
58
Revised August 2005 by Brian LaBombard
P dimension is optional. If it is not given, the retract height will be the same as the Z start height
(R dimension).
F feed rate is optional. If it is not given, the current feed rate is used.
All start and finish heights (R and P) as well as Z dimensions are absolute dimensions.
P must be less than R, or an alarm will be given.
For all peck drill cycles (G83 and G87), R (start height) must be. 1" (or 2mm) above the work
surface.
G84 (Tapping) uses S word for Spindle Yes/No. Your machine must be equipped with spindle
M-functions to use G84.
Description
Absolute hole depth. Required.
Initial Z start point, in rapid. Required.
Feed rate.
Z return point after hole depth, in rapid. P must be
higher than R.
Counterboring (G82)
Syntax: G82 Zn Rn Fn Dn Pn
G82 is generally used for counter boring. It feeds from the R-plane to a Z depth, dwells for a specified
time, then rapids to the return point.
Address
Word
Z
R
F
D
P
Description
Absolute hole depth. Required.
Initial Z start point, in rapid. Required.
Feed rate
Dwell time (in seconds). Required.
Z return point after hole depth, in rapid. P must be
higher than R.
60
Revised August 2005 by Brian LaBombard
Address
Word
Description
Z
Absolute hole depth, Required.
R
Initial Z start point, in rapid. Required.
F
Feed rate.
Maximum peck distance (positive dimension.
I
Required.
Z return point after hole depth, in rapid. P must be
P
higher than R.
61
Revised August 2005 by Brian LaBombard
62
Revised August 2005 by Brian LaBombard
Description
Absolute hole depth. Required.
Initial Z start point, in rapid. Required.
Feedrate.
Z return point after hole depth, in feed.
63
Revised August 2005 by Brian LaBombard
Description
Absolute hole depth. Required.
Initial Z start point, in rapid. Required.
Feedrate.
First peck distance (positive dimension). Required.
Amount to subtract from previous peck (positive
dimension). Required.
Minimum peck distance (positive dimension).
Required.
Chip break increment (positive dimension).
Incremental depth between full retracts (positive
dimension).
Z return point after hole depth, in rapid. P must be
higher than R.
64
Revised August 2005 by Brian LaBombard
65
Revised August 2005 by Brian LaBombard
N3
N4
N5
N6
N7
N8
N9
N10
N11
N12
N13
N14
Description
Program number (1) and name
(DRILL- EX1).
G90 G70 (G71) G0 T0 Z0
Sets absolute dimensions (G90),
inch input (G70), rapid (G0), cancel
any active tool (T0), and bring Z to
zero (Z0).
X-3.0 (X-75) Y1.0 (Y25)
Move to X-3 Y1.
T01 * 1/4" DRILL (6.35 DRILL) Activate Tool #1 length offset.
G83 Z-.55 (Z-14) R.1 (R2) F12
Initiates peck drill cycle G83: Z =
(F300) I.08 (I2) P.1 (P2)
hole depth, R = start height, F =
feed rate, I = maximum peck, P =
return height.
X1.0 (X25.4) Y-1.0 (Y-25.4)
Hole location #1 (Rapid and
Absolute).
X3.0 (X76.2)
Hole #2.
G91 X1.5 (X38.1)
Hole #3 (moves from #2 to #3 in
incremental: G91).
X1.0 (X25.4) Y -1.25 (Y-31.75)
Hole #4 (Incremental).
X-2.5 (X-63.5)
Hole #5 (Incremental).
G90 X1.5 (X38.1) Y -2.5 (Y-63.5) Hole #6 (Absolute).
G80 T0 Z0
Cancel drill cycle (G80), cancel tool
(T0), and rapid Z to zero (Z0).
X-3.0 (X-75) Y1.0 (Y25)
Move to X-3 Y1 for part change.
M02
End Program.
NOTE: This program is written in BOTH inch and mm. ALL mm values are displayed in brackets.
66
Revised August 2005 by Brian LaBombard
67
Revised August 2005 by Brian LaBombard
68
Revised August 2005 by Brian LaBombard
69
Revised August 2005 by Brian LaBombard
70
Revised August 2005 by Brian LaBombard
71
Revised August 2005 by Brian LaBombard
72
Revised August 2005 by Brian LaBombard
74
Revised August 2005 by Brian LaBombard
75
Revised August 2005 by Brian LaBombard
Tool moves from position 1 to a position 45 degrees from center, at half the radius (position 2).
Tool then arcs onto the O. D. tangential (CCW) (position 3).
Tool mills O.D. CCW (position 4).
Tool leaves O.D. tangentially to a point 135 degrees from the center at half the radius. CCW
(position 5).
5. Tool returns to center (position 6).
6. If you have programmed a finish pass, the process repeats at the finish dimensions.
76
Revised August 2005 by Brian LaBombard
Tool will move to X2 Y2 (position 1) in current modes: G0/1, G90/91, G70/71 (position 1).
Tool will feed. 1 in. (2mm) down in Z-axis.
Tool will move to O.D. (less finish stock) in a 3-axis spiral motion (position 2).
Tool will make a full circle (position 2).
Tool then spirals inward to complete the roughing cycle, at the first level.
If you have specified a finish pass, repeat steps 3 through 5 at the finish feedrate.
Tool rapids to P dimension, then to the original XY location.
78
Revised August 2005 by Brian LaBombard
Tool moves to the center of the radius in the lower-left corner (position 1).
Tool feeds -.1" (2mm) to meet the part surface.
Tool moves in XYZ toward center of pocket (position 2) to the first roughing depth, at feedrate I.
Tool mills out the pocket with straight lines and arcs (if necessary), using feedrate J, until first
level is completed.
5. Tool repeats this process if necessary to achieve full depth (less finish stock).
6. Optional finish pass is made in the same manner at feedrate K.
7. When the pocket is complete, tool rapids to P, then to the center of the pocket.
80
Revised August 2005 by Brian LaBombard
SUBPROGRAM/SUBROUTINE FUNCTIONS
Subprograms (M98, M99)
When a program contains a fixed sequence of movements or a repeated pattern, such a sequence or pattern can
be stored as a separate program called a subprogram.
A subprogram can be called from a main program.
A called subprogram can also be called from another subprogram.
Format
Subprogram
Configuration
Subprogram call
Explanations
81
Revised August 2005 by Brian LaBombard
SUBPROGRAM/SUBROUTINE FUNCTIONS
Subprogram Examples
M98 P51002 ;
o This command specifies Call the subprogram (number 1002) five times in succession. A
subprogram call command (M98P_) can be specified in the same block as a move command.
82
Revised August 2005 by Brian LaBombard
SUBPROGRAM/SUBROUTINE FUNCTIONS
Special Usage
Specifying the
sequence number for
the return destination
in the main program
Subprogram
N0010;
N0020;
N0030 M98 P1010;
N0040;
N0050;
N0060;
O1010...;
N1020;
N1030;
N1040;
N1050;
N1060 M99 P0050;
83
Revised August 2005 by Brian LaBombard
N0010 ;
N0020 ;
N0030 ;
N0040 ;
N0050 ;
/ N0060 M99 P0030 Block Skip
N0070 ;
ON
N0080 M02;
SUBPROGRAM/SUBROUTINE FUNCTIONS
Using a subprogram
only
A subprogram can be executed just like a main program by searching for the
start of the subprogram with the MDI.
In this case, if a block containing M99 is executed, control returns to the start
of the subprogram for repeated execution. If a block containing M99 Pn is
executed, control returns to the block with sequence number n in the
subprogram for repeated execution. To terminate this program, a block
containing /M02; or /M30; must be placed at an appropriate location, and the
optional block switch must be set to OFF. This switch is to be set to ON
first.
N1010 ;
N1020 ;
N1030 ;
/ N1040 M30;
N1050 M99 P1020;
84
Revised August 2005 by Brian LaBombard
Optional
Skip Block
ON
85
Revised August 2005 by Brian LaBombard
APPENDIX A
Fanuc
and
ANILAM
86
Revised August 2005 by Brian LaBombard
Function
Program stop.
Optional Stop. Optional stop switch must be set to ON. Must hit Cycle
Start after any time to continue program operation
End of Program. Rewinds program in memory
Spindle ON Clockwise (CW)
Spindle ON Counterclockwise (CCW)
Stop the spindle
Perform Automatic Tool Change (ATC) Z will automatically move to
tool change position
Coolant ON
Coolant OFF
Marks end of a subroutine
Orients Spindle
End of Program. Rewinds program, stops spindle and stops coolant
Call a subprogram (can be executed from a Main or Sub program)
End a subprogram or subroutine
87
Revised August 2005 by Brian LaBombard
Group
01
00
17
02
06
04
24
00
01
00
07
19
08
Function
Rapid traverse positioning
Linear positioning by feedrate
Circular interpolation/Helical interpolation CW by feedrate
Circular interpolation/Helical interpolation CCW by feedrate
Dwell, Exact stop
High speed machining cycle
AI advanced control
Cylindrical interpolation
Advanced preview contol
Exact stop
Programmable data input
Programmable data input mode cancel
Polar coordinate command cancel
Polar coordinate command
XY plane selection
ZX plane selection
YZ plane selection
Program input in inches
Program input in mm
Stored stroke check function on
Stored stroke check function off
Spindle speed fluctuation detection off
Spindle speed fluctuation detection on
Reference point return check
Return to reference point
Return from reference point
2nd, 3rd, and 4th reference position return
Skip function
Thread cutting
Automatic tool length measurement
Corner offset circular interpolation
Cutter compensation cancel/ 3 dimensional compensation cancel
Cutter compensation offset to the left/ 3 dimensional compensatlion
Cutter compensation offset to the right
Normal direction control cancel mode
Normal direction control left side on
Normal direction control right side on
Tool length compensation + (plus) direction
Tool length compensation - (minus) direction
88
Revised August 2005 by Brian LaBombard
Group
00
08
11
22
00
14
00
15
00
12
16
09
09
Function
Tool offset increases
Tool offset decreases
Tool offset increases double
Tool offset decreases double
Tool length compensation cancel
Scaling off
Scaling on
Programmable mirror image cancel
Programmable mirror image on
Local coordinate system setting
Machine coordinate system setting
Workpiece coordinate system 1 selected
Workpiece coordinate system 2 selected
Workpiece coordinate system 3 selected
Workpiece coordinate system 4 selected
Workpiece coordinate system 5 selected
Workpiece coordinate system 6 selected
Single direction positioning
Exact stop mode
Automatic corner override
Tapping mode
Cutting mode
Macro call
Macro modal call
Macro modal call cancel
Coordinate rotation/ 3 dimensional coordinate conversion
Coordinate rotation cancel/ 3 dimensional coordinate conversion cancel
Peck drilling cycle
Left hand tapping cycle
Find boring cycle
Canned cycle cancel/ external operation function cancel
Drilling cycle, spot boring cycle, or external operation function
Drilling cycle or counter boring cycle
Deep hole drilling cycle
Right hand tapping cycle
Various boring cycles
89
Revised August 2005 by Brian LaBombard
G Code
XG90
Z G91
G92
G92.1
XG94
G95
G96
XG97
XG98
G99
Group
Function
03
00
06
13
10
Note:
X - Indicates default value at machine power up
Z - Indicates alternate default value for machine power up
90
Revised August 2005 by Brian LaBombard
Non-Modal
G-Code Function
G4
Dwell
G5
Ellipse
G9
Exact Stop Check
G28 Return to Machine Home
G29 Return from Machine Home
G45 Mold Rotation
G49 Elbow Milling
G62 Automatic Feed Override for Arcs
G63 Automatic Feed Override for Arcs
Cancel
Modal Corner Rounding
G65 User Macro Single Call
Modal Corner Rounding Off
G66 User Macro Modal Call
Exact Stop Check Mode
G67 User Macro Modal Call Cancel
Cutting Mode (Continuous Path ON)
G68 Coordinate System Rotation
User Macro Modal Call
G73 Draft Pocket Milling Cycle
User Macro Modal Call Cancel
G74 Area Clearance (Face) Cycle
Coordinate System Rotation
G75 Frame Milling
Inch Programming
G76 Hole Milling Cycle
MM Programming
G77 Circular Pocket Cycle
Axis Scaling
G78 Rectangular Pocket Cycle
Absolute Programming
G79 Bolt Hole Circle Cycle
Incremental Programming
G80 Cancel Modal Drilling
Per Minute Feed
G169 Area Clearance
Per Revolution Feed
G170 Facing Cycle
Basic Drilling Cycle
G171 Circular Profile Cycle
Counterbore Drilling Cycle
G172 Rectangular Profile Cycle
Basic Peck Cycle
G177 Plunge Circular Pocket
Tapping Cycle
G178 Plunge Rectangular Pocket
Basic Bore Cycle
G179 Hole Pattern Drilling
Unidirectional Boring Cycle
Chip Break Drilling Cycle
Flat Bottom Bore Cycle
Absolute Zero Preset
Function
Positioning-Rapid Traverse
Linear Interpolation-Feed
Circular Interpolation-CW
Circular Interpolation-CCW
Stored Stroke Limit ON
Tool Radius Compensation, Cancel
Tool Radius Compensation (Left)
Tool Radius Compensation (Right)
Work Coordinate System
91
Revised August 2005 by Brian LaBombard
APPENDIX B
Charts
And
Tables
92
Revised August 2005 by Brian LaBombard
93
Revised August 2005 by Brian LaBombard
94
Revised August 2005 by Brian LaBombard
95
Revised August 2005 by Brian LaBombard