You are on page 1of 5

http://tamir86.bIogfa.

com

CNC Machine Language
G-Code List
G-Code is one of a number of computer code languages that are used
to instruct CNC machining devices what motions they need to perform
such as work coordinates, canned cycles, and multiple repetitive cycles.
ndustry has standardized on G-Code as its basic set of CNC machine
codes.
G-Code is the most popular programming language used for
programming CNC machinery. Some G words alter the state of the
machine so that it changes from cutting straight lines to cutting arcs.
Other G words cause the interpretation of numbers as millimeters rather
than inches. Some G words set or remove tool length or diameter
offsets.
Below is a complete listing of current codes.
G-Code Description
G00 Rapid Linear nterpolation
G01 Linear nterpolation
G02 Clockwise Circular nterpolation
G03 Counter Clockwise Circular nterpolation
G04 Dwell
G05 High Speed Machining Mode
G10 Offset nput By Program
G12 Clockwise Circle With Entrance And Exit Arcs
G13 Counter Clockwise Circle With Entrance And Exit Arcs
G17 X-Y Plane Selection
G18 Z-X Plane Selection
G19 Y-Z Plane Selection
G28 Return To Reference Point
G34 Special Fixed Cycle (Bolt Hole Circle)
G35 Special Fixed Cycle (Line At Angle)
G36 Special Fixed Cycle (Arc)
G37 Special Fixed Cycle (Grid)
com . bIogfa . 86 tamir :// http

G40 Tool Radius Compensation Cancel
G41 Tool Radius Compensation Left
G42 Tool Radius Compensation Right
G43 Tool Length Compensation
G44 Tool Length Compensation Cancel
G45 Tool Offset ncrease
G46 Tool Offset Decrease
G50.1 Programmed Mirror mage Cancel
G51.1 Programmed Mirror mage On
G52 Local Coordinate Setting
G54 - G59 Work Coordinate Registers 1 Thru 6
G60 Unidirectional Positioning
G61 Exact Stop Check Mode
G65 Macro Call (Non Modal)
G66 Macro Call (Modal)
G68 Programmed Coordinate Rotation
G69 Coordinate Rotation Cancel
G73 Fixed Cycle (Step)
G74 Fixed Cycle (Reverse Tapping)
G76 Fixed Cycle (Fine Boring)
G80 Fixed Cycle Cancel
G81 Fixed Cycle (Drilling / Spot Drilling)
G82 Fixed Cycle (Drilling / Counter Boring)
G83 Fixed Cycle (Deep Hole Drilling)
G84 Fixed Cycle (Tapping)
G85 Fixed Cycle (Boring)
G86 Fixed Cycle (Boring)
G87 Fixed Cycle (Back Boring)
G88 Fixed Cycle (Boring)
G89 Fixed Cycle (Boring)
G90 Absolute Value Command
G91 ncremental Value Command
G92 Work Offset Set
com . bIogfa . 86 tamir :// http


G107 User macro 1 (sine) sin
G108 User macro 1 (cosine) cos
G109 User macro 1 (arc tangent) tan
G110 User macro (square root)
G200 User macro 1 (unconditional branch)
G201 User macro 1 (zero condition branch)
G202 User macro (negative condition branch)



Basic ISO CNC Code


M03, M04, M05 Spindle CW, Spindle CCW,
Spindle Stop
M08, M09 Coolant/lubricant On,
Coolant/lubricant Off
M02 Program Stop
M30 Program end, rewind
M98 Subprogram call
M99 Return to call program
M00, M01 Program stop, optional stop
G96, G97 Constant surface speed, Constant
Spindle speed
G50 Maximum spindle speed
G95, G94 Feed mm per revolution, feed mm/min
G00, G01 rapid movement, Linear Interpolation
(cutting in a straight line)
F Feed
S Spindle Speed



http://tamir86.bIogfa.com
Example
This is a generic program that demonstrates the use oI G-Code
to turn a 1" diameter X 1" long part. Assume that a bar oI
material is in the machine and that the bar is slightly oversized
in length and diameter and that the bar protrudes by more than
1" Irom the Iace oI the chuck. (Caution: This is generic, it might
not work on any real machine! Pay particular attention to point 5
below.)

Line Code Description
N01 M216 Turn on load monitor
N02 G00 X20 Z20
Rapid move away Irom the part, to ensure the starting position
oI the tool
N03 G50 S2000 Set Maximum spindle speed
N04 M01 Optional stop
N05 T0303 M6
Select tool #3 Irom the carousel, use tool oIIset values located
in line 3 oI the program table, index the turret to select new
tool
N06
G96 S854 M42
M03 M08
Variable speed cutting, 854 It/min, High spindle gear, Start
spindle CW rotation, Turn the Ilood coolant on
N07 G00 X1.1 Z1.1
Rapid Ieed to a point 0.1" Irom the end oI the bar and 0.05"
Irom the side
N08 G01 Z1.0 F.05
Feed in horizontally until the tool is standing 1" Irom the
datum
N09 X0.0 Feed down until the tool is on center - Face the end oI the bar
N10 G00 Z1.1 Rapid Ieed 0.1" away Irom the end oI the bar
N11 X1.0 Rapid Ieed up until the tool is standing at the Iinished OD
N12
G01
Z0.0
Feed in horizontally cutting the bar to 1" diameter all the way to the
datum
N13 M05 M09 Stop the spindle, Turn oII the coolant
N14
G28 G91
X0
Home X axis in the machine coordinate system, then home all other
axes
N15 M215 Turn the load monitor oII
N16 M30
Program stop, pallet change iI applicable, rewind to beginning oI the
program



,I.. _,,.I:_:.c_..:_I.,.I. ) _:Ll_.>._...
<.I, _I.,.I..I>_. cnc ) _I.,_...
cI., CNCezPRO"
cI., Tesko laser

..:r _>l: c,I,


_,.I com . gmail delkhoon
c9, com . blogfa . 86 tamir :// http