Você está na página 1de 48

CNC Codes and

Letters

NOTE: The following will be a listing and


description of Computer Numerical Control
(CNC) Codes and Letter designations. We
will try to stick with only generic codes
that will work on most machines. Some
examples may be specifically for the
machines we have at South Adams / Area
18 Machine Trades. Please contact the
instructor if you find any errors, missing
items, or anything you would like to see
added. jdailey@southadams.k12.in.us

Code

Meaning

G00

Positioning (Rapid Traverse)

G01
G02

Letter

Meaning

Rotary indexing axis around the "X" axis

Linear Interpolation (Feed)

Rotary indexing axis around the "Y" axis

Circular Interpolation CW

Rotary indexing axis around the "Z" axis

G03

Circular Interpolation CCW

Cutter Radius / Diameter offset number

G04

Dwell

Feedrate in inches per revolution (Lathe)

G17

X,Y Plane of Interpolation

Feedrate in inches per minute (can be used on lathes)

G18

X,Z Plane of Interpolation

Preparatory commands

G19

Y,Z Plane of Interpolation

Offset Number (Mill - tool length)(Lathe - Position offset)

G20

Input in Inch

Arc center location in the "X" axis

G21

Input in MM

Arc center location in the "Y" axis

G28

Return to Machine zero (reference point)

Arc center location in the "Z" axis

G40

Cutter Compensation cancel

Fixed Cycle repetion count / subprogram repetition count

G41

Cutter Compensation left

Miscellaneous function

G42

Cutter Compensation right

Block / Sequence number

G43

Tool length compensation +

Program Number

G44

Tool length compensation -

Subprogram / Macro Number call

Dwell time in milliseconds

G54-G59 Set Local Coordinate Systems (Datum Shifts)


G80

Canned Cycle cancel

Block number in main program when used with M99

G81

Spot Drilling Cycle (no dwell)

Depth of peck in fixed cycles (G73and G83)

G82

Drill/Counterbore (with dwell)

Shift amount in fixed cycle (G76 and G87)

G83

Peck Drilling Cycle

Retract point in fixed cycles

G85

Bore

Arc Radius designation

G90

Absolute Programming

Spindle speed in RPMs

G91

Incremental Programming

Tool function

G92

Set Program Zero

Incremental move in "X" axis

G94

IPM Programming

Incremental move in "Y" axis

G95

IPR Programming

Incremental move in "Z" axis

M00

Program stop

"X" axis coordinate value designation

M01

Optional stop

"Y" axis coordinate value designation

M02

End of Program

"Z" axis coordinate value designation

M03

Start Spindle (Clockwise)

M04

Start Spindle (Counterclockwise)

M05

Spindle off

M06

Tool change

M08

Coolant on

M09

Coolant off

M30

Program reset/tape rewind

M98

Sub-Program call

M99

Return to previous program

You should already


have a list of G&M
Codes and CNC
Letters as shown.
If you do not have
one, see your
instructor, or
download one off
of the South
Adams / Area 18
Machine Trades

G Codes
- G Codes are known as Preparatory
Commands which means they are
preparing the CNC machine to do
something.
- Normally there should only be one G
code per line, one exception is in the
Safety Line at the beginning of the
program.
- G Codes are to be at the start of the
Block of Program.

G00 Positioning Rapid


Traverse

-First of all notice that it is G Zero


Zero all of the G&M Codes use Zero
and not the letter O.
-G00 means the tool is going to move
from where ever it currently is to the
next position in a straight line as fast as
the machine will go.
- Think of G00 as a dragster,
something that will go from point A to
point B in a straight line as fast as
possible
Example: G00 X2.00 Y3.00

G01 Linear Interpolation


- G01 means the tool is going to move from where
ever it currently is to the next position in a straight line
but this time with a given feedrate.
- Think of G01 as a truck driving on highway 218 or
124 through Adams County, Indiana, these highways
are straight AND they have a speed limit.
- On Milling Machines, the feedrate will typically be in
IPM (inches per minute) and labeled with an F.
-On Turning Machines, the feedrate will typically be in
IPR (inches per revolution) and labeled with an E or F

Example: G01 X2.00 Y3.00 F6.00

G02 Circular Interpolation


(CW)

-G02 Used anytime you need an arc in


the Clockwise direction.
- As with any Interpolation (machine
movement), the machine already knows
where it is, you only need to tell it where
you want to go next.
-For example: if you are setting at X0,Y0
and you want to put a 1.00 radius to
X1.00, Y1.00 the Block would look like
one of the following:
G02 X1.00 Y1.00 R1.00 F12.0
G02 X1.00 Y1.00 I1.00 J0 F12.0

G03 Circular Interpolation


(CCW)

-Just like with the G02 preparatory


command, the G03 will move from point
A to Point B only this time in a Counter
Clockwise direction.
- The Block of code will look identical to
the code for G02 only the code will
change.
G03 X1.00 Y1.00 R1.00 F12.0
G03 X1.00 Y1.00 I1.00 J0 F12.0
- Always keep an eye on the details, the difference
between G02 and G03 would be devastating if you

CNC Vocab pit stop


- Modal[mohd-l]
- ACommandthatistoremainina
certainmodeuntilcanceledby
anothermode
- Inotherwords:itkeepsgoingand
goingandgoingandgoing..Until
itistoldtostoplaterintheprogram

- Antonym=Non-modal

G04 Dwell

-G04 is used anytime you want to


pause or dwell at a position
- A common Block when Dwell is
required would be G04 P500
-The G04 of course specifies Dwell
-The P500 states that it will be for 500
milliseconds

- Note: 1 Second equals 1000


milliseconds
- Therefore if you need to pause for 4.5
seconds you would program the Block as:

G17 X,Y Plane of


Interpolation

-G17 is the most common plane to


choose for a vertical machining center.
-G17 will normally be one of if not THE
first G code in a program.
- The reason the G17 is so popular is
that it could also refer to the table in
front of you, the X axis is right and left
movements while the Y axis would be
towards and away from you

G18 X,Z Plane of


Interpolation

-G18 could best be described as a


normal engine lathe because the Z
axis is the longitudinal travel of the
lathe and the X axis would be your
cross slide.
- On a vertical machining center, this
plane would be like looking at the screen
of the controller since the X axis is
right and left and the Z axis is up and
down.

G19 Y,Z Plane of


Interpolation

-On a Vertical milling machine, this


would be the plane parallel to the side of
the machine.
- Once again, just think it through, the Y
axis is towards and away from you and
the Z axis is up and down.

G20 Inch Input


-G20 will typically be at the beginning
of the program, that way the CNC knows
right away that every dimension entered
will be Inch and not metric.
- G20 is very important to enter into
each program you want to be inch,
imagine if the program that ran prior to
yours was a metric program and you do
not switch it to inch, every dimension
you enter will be read by the CNC as
metric. OPPS!

G21 Metric Input


-Many shops have switched over to total
metric, so G21 is becoming more
popular in this area.
- How you program using G21 is
identical to G20 the only difference is
you are entering Metric dimensions
instead of Inch.

G28 Return to Machine


Zero
-AKA: Return to Reference Point
- G28 can be very handy, On a Vertical
Machining Center anytime you want the
tool as far away from the part vertically
as possible you would enter G28 G91
Z0. If you want the part to come as
close to you as possible for easy part
changing you would enter G28 Y0
-Example: G28 G91 X0 Y0 Z0 Would
bring the machine as fast as it can to its

G40 Cutter Compensation


Cancel

-Typically found in the Safety Line of the


program
- Just like the description implies, G40 is
used to cancel any cutter compensations
whether it is for length (or height)
compensation or Diameter Compensation.
- Keep in mind that the person operating
the machine prior to you could have done
something with cutter compensation
totally legal BUT different than what you
need, cutter compensation cancel will
clear everything out and be ready for you

G41 Cutter
Compensation
Left
-Cutter compensation is used to program
a part exactly to size using the
dimensions provided on the print.
THEN at the machine, offset that
geometry to compensate for the tool you
are using
- Imagine climb milling around the
outside of this picture the cutter would
be rotating clockwise and moving around
the picture clockwise, now guess which
side of the part the cutter is. Your

G42 Cutter
Compensation
Right
- Just like the G41 compensation only
the opposite. Imagine conventional
milling the same outside of this picture,
the cutter is still spinning clockwise but
this time the cutter is traveling
counterclockwise around the outside of
the part.
NOW which side of the part is the cutter
traveling on? You are right the Right
side!

G43 Tool Length


Compensation
+
Tool length compensation allows a

machine to adjust for the different


lengths of the tools.
- Basically it is telling the machine how
far it is from its Z home position to
the position when the part touches the
Z origin of the part.
- The H value will be Added (+) to
programmed Z position
Example: G43 Z1.0 H01

G44 Tool Length


Compensation
Tool length compensation allows a

machine to adjust for the different


lengths of the tools.
- Basically it is telling the machine how
far it is from its Z home position to
the position when the part touches the
Z origin of the part.
- The H value will be Subtracted (-)
from the programmed Z position
Example: G44 Z1.0 H01

G54-G59 Work Offsets


- AKA: Datum Shifts
- AKA: Set Local Coordinate Systems
- Specifies the distance the machine
would need to move from its home
position to the origin of the part or
fixture.
- Used mostly when multiple parts /
fixtures / Set-ups are on the same
table
Example: G55 G90 G00 X0.000 Y0.000

G80 Canned Cycle


Cancel
AKA: Fixed Cycle Cancel

- Clears out any Modal Canned or


Fixed cycles used earlier in a program
- Used in the Safety Line to insure that
what someone else did before does
not affect what you will be doing in
your program
Example: G82 X2.00 Y3.00 R.100 Z-.500
F6.0
G80

G81 Spot Drill Cycle (no


dwell)
- Specifies that you want to drill to a
given depth
- Along with the G81 you will also need
to specify the following:
-

Hole Position
R-Plane
Z Depth
Feedrate

Example: G81 X2.00 Y3.00 R.100 Z-.250

G82 Spot Drill Cycle


(dwell)
Specifies that you want to drill to a

given depth
- Along with the G82 you will also need
to specify the following:
-

Hole Position
R-Plane
Z Depth
Feedrate
Dwell time

Example: G82 X2.00 Y3.00 R.100 Z-.250


F6.0 P500

G83 Peck Drill Cycle


- Specifies that you want to drill to a
given depth
- Along with the G83 you will also need
to specify the following:
-

Hole Position
R-Plane
Z Depth
Feedrate
Peck Increment

Example:

G83 Peck Drill Cycle


Comparison
G83 X2.00 Y3.00 Z-1.500 R.100 Q.250
F6.0
- OR N0110
N0120
N0130
N0140
N0150
N0160
N0170

G00
G00
G01
G00
G00
G01
G00

X2.00 Y3.00
Z.100
Z-.150 F6.0
Z.1
Z-.150
Z-.400
Z.1

WE ARE NOT DONE


YET
N0180 G00 Z-.400
N0190
N0200
N0210
N0220
N0230
N0240
N0250
N0260

G01
G00
G00
G01
G00
G00
G01
G00

Z-.650
Z.100
Z-.650
Z-.900
Z.100
Z-.900
Z-1.150
Z.100

STILL A COUPLE MORE


LINES
N0270 G00 Z-1.150
N0280 G01 Z-1.250
N0290 G00 Z.100
That is just for one hole! Now imagine
doing that for EVERY deep hole!
One line per hole versus 19 Lines you
decide!

G73 Peck Drill Cycle


(High
Speed)
Specifies that you want to drill to a

given depth
- Does NOT fully retract after each peck
depth
- Along with the G73 you will also need
to specify the following:
-

Hole Position
R-Plane
Z Depth
Feedrate
Peck Increment

G84 Tapping Cycle (RH)


- Specifies that you want to Tap a
previously drilled hole
- Along with the G85 you will also need
to specify the following:
-

Hole Position
R-Plane
Z Depth
Feedrate = RPM X Lead of the thread
-

1/4-20 Thread at 800RPM = F40.0

Example: G84 X2.00 Y3.00 R.100 Z-.250


F40.0

G85 Boring Cycle


- Specifies that you want to Bore to a
given depth
- Along with the G85 you will also need
to specify the following:
-

Hole Position
R-Plane
Z Depth
Feedrate

Example: G85 X2.00 Y3.00 R.100 Z-.250


F6.0

CNC Vocab pit stop


- Cartesian Coordinate
System(krt'zhn)

Asysteminwhichthelocationofapointisgiven
bycoordinatesthatrepresentitsdistancesfrom
perpendicularlinesthatintersectatapointcalled
theorigin.

G90 Absolute
Programming
The Origin or Datum location of your

part does not move.


- ALL coordinates are in relationship to
one location in space

Example: G90 G00 X2.00 Y3.00 Z1.00

G91 Incremental
Programming
The Origin or Datum location of your

part does moves as your tool moves


- ALL coordinates are in relationship to
the point the tool is located at

Example: G91 G00 X2.00 Y3.00 Z1.00

M Codes
- M Codes are known as
Miscellaneous Functions.
- Normally there should only be one M
code per line. Most machines are really
picky about this, more so than with G
codes.
- M Codes are to be at the start of the
Block of Program.
Example: M03 S1500

M00 Program Stop


- REMINDER: notice that it is M Zero
Zero all of the G&M Codes use Zero
and not the letter O.
- M00 will stop the program without
pressing Feed Hold
- Insert M00 whenever you want to stop
the program no matter what the
conditions are.
- Note: on some machines this will also
turn off the spindle and not restart it
without a M03

M01 Optional Stop


- M01 is a conditional stop, it is
determined by an operator activated
switch on the control panel
- If the switch is on, it will stop the
program identical to a M00
- If the switch is off, it will ignore the
M01
- Best uses:
- Before or After Tool Changes
- Anytime you want to inspect, oil or
manipulate the part or tool

M02 End of Program


- M02 is used only at the end of the
program
- Some machines will not start a
program unless it knows there is an
end
- M02 does not rewind the program

Example: M02
%

M03 Spindle Rotation


Normal
M03 Mill Clockwise rotation If you

were on top of a vertical milling


machine looking down
- M03 Lathe Normal Rotation the
direction the chuck would need to spin
if you had a normal right hand helix
drill bit

Example: M03 S1200

M04 Spindle Rotation


Reverse
M04 Mill Counter-Clockwise rotation

If you were on top of a vertical milling


machine looking down
- M03 Lathe Reverse Rotation the
opposite direction the chuck would
need to spin if you had a normal right
hand helix drill bit

Example: M04 S1200

M05 Spindle Off


- Turns spindle off

Example: M05

M06 Automatic Tool


Changer
AKA: ATC

- Will put away the tool that is in the


spindle and replace it with the tool
that is identified on the same line as
the M06

Example: M06 T01


or
T01 M06

M07 Mist Coolant On


- Turns on Mist Coolant

Example: M07

M08 Flood Coolant On


- Turns on Flood Coolant

Example: M08

M08 Coolant Off


- Turns Off All Coolant pumps /
Soleniods

Example: M09

M30 End of Program &


Rewind
- M30 is used only at the end of the
program
- Some machines will not start a
program unless it knows there is an
end
- M30 does rewind the program
- All you have to do is change the part and
press cycle start

- More common than M02


- Especially if more than one part is to be
made

M98 Sub-Program Call


- Used in a main program when you
want to call up another program while
still in the main program.

Example: M98 P1001

M99 Sub-Program End


- Used in place of an M30 when a
program is used as a sub-program

Example: M99
%

Você também pode gostar