Haas Mill Programming Manual PDF
Haas Mill Programming Manual PDF
Mill Series
Training Manual
Haas CNC
Mill Programming
INTRODUCTION ........................................................................................................................................................ 5
MACHINE HOME WITH WORK OFFSETS.................................................................................................................... 7
WORK COORDINATE SELECTION ..................................................................................................................................... 8
TOOL LENGTH COMPENSATION G43 ........................................................................................................................ 9
ABSOLUTE AND INCREMENTAL POSITIONING ........................................................................................................ 10
THE CARTESIAN COORDINATE SYSTEM............................................................................................................................ 11
WORD ADDRESS PROGRAMMING ................................................................................................................................. 12
PROGRAMMING ....................................................................................................................................................... 13
ALPHABET WORD ADDRESS ASSIGNMENTS ........................................................................................................... 14
PREPARATORY FUNCTIONS (G CODES) ................................................................................................................... 19
MACHINE FUNCTIONS (M CODES) .......................................................................................................................... 22
PROGRAM STRUCTURE AND FORMAT.................................................................................................................... 26
PROGRAM FORMAT .................................................................................................................................................. 27
MACHINE DEFAULTS ................................................................................................................................................. 28
PROGRAMMING WITH CODES ...................................................................................................................................... 29
PROGRAM STRUCTURE............................................................................................................................................... 30
LINEAR AND CIRCULAR TOOL PATHS ...................................................................................................................... 32
LINEAR/CIRCULAR MOVEMENT CREATING TOOL PATH .................................................................................................... 33
INTERPOLATION COMMANDS ....................................................................................................................................... 34
CIRCULAR INTERPOLATION (G02 AND G03) COMMANDS ................................................................................................... 35
CUTTER COMPENSATION (G41, G42) ...................................................................................................................... 42
FORMULAS TAPPING, SPEEDS AND FEEDS ........................................................................................................... 50
DRILLING, TAPPING, BORING CANNED CYCLES ....................................................................................................... 51
CANNED CYCLES...................................................................................................................................................... 52
LOOPING COMMAND CYCLES ................................................................................................................................. 70
BOLT HOLE PATTERNS ............................................................................................................................................ 72
ADDITIONAL G CODES............................................................................................................................................. 78
MILLING CIRCLES WITH CUTTER COMP................................................................................................................... 79
THREAD MILLING .................................................................................................................................................... 80
CIRCULAR POCKET MILLING USING G12 AND G13 .................................................................................................. 81
CIRCULAR PLANE SELECTION .................................................................................................................................. 86
INCH / METRIC SELECTION (G20, G21) ......................................................................................................................... 87
SETTING WORK, TOOL OFFSETS THROUGH THE PROGRAM (G10) .......................................................................... 88
GENERAL PURPOSE POCKET MILLING (G150).......................................................................................................... 89
ENGRAVING (G47) .................................................................................................................................................. 96
SUBROUTINES (SUBPROGRAMS) .......................................................................................................................... 101
SUBROUTINES ........................................................................................................................................................ 102
EXERCISES ............................................................................................................................................................. 104
FINAL EXERCISES................................................................................................................................................ 108
NOTE: Some text and illustrations in this manual are from Haas Automation VF/HS Series Programming
Workbook, June 2006
Page 2
Page 3
Page 4
Introduction
Welcome to Productivity, Inc., your local Haas Factory Outlet (H.F.O.) for the Mill Programming Class. This
class is intended to give a basic understanding of the programming of a Haas Machining Center.
After 1945 design of wings for the US Air Force were becoming extremely complex and hard to
manufacture using conventional machine tools. MIT developed a machine that was able to control a
cutting tool path with a series of straight lines defined by axial coordinates at prescribed feed rates. The
first NC machine tool was introduced to the defense and aerospace industry by MIT in 1952. The contour
of a constantly changing curvature could be described by a series of short lines determined by a series of
coordinate in three axes.
The first machine tools were run with instructions or programs punched out on paper tape. The files of
the early machine tools were often in the format which later became known as G-code. The reason for
the name being that many of the lines of text began with the letter G.
In an NC machine, the tool is controlled by a code system that enables it to be operated with minimal
supervision and with a great deal of repeatability. "CNC" (Computerized Numerical Control) is the same
type of operating system, with the exception that a computer monitors the machine tool.
The same principles used in operating a manual machine are used in programming a NC or CNC Machine.
The main difference is that instead of cranking handles to a position on a slide to a certain point, the
dimension is stored in the memory of the machine control once. The control will then move the machine
to these positions each time the program is run.
The operation of the VF-Series Vertical Machining Center requires that a part program be designed,
written, and entered into the memory of the control. There are several options for getting these programs
to the control. RS-232 (serial port with a computer), 3.5 Floppy Disk, Ethernet / Networking/ and USB are
all viable ways to transmit and receive programs.
In order to operate and program a CNC controlled machine, a basic understanding of machining practices
and a working knowledge of math are necessary. It is also important to become familiar with the control
console and the placement of the keys, switches, displays, etc., that are pertinent to the operation of the
machine.
This manual is intended to give a basic understanding of CNC programming and its applications. It is not
intended as an in-depth study of all ranges of machine use, but as an overview of common and potential
situations facing CNC programmers. Also use of the new Haas Control feature Intuitive Programming
System or (IPS) will be demonstrated. It will produce G-Code programs for simple machine operations.
Page 5
Page 6
This is crucial to the operation and function of a CNC machine as all of our programs, fixturing, and tooling
are based off of machine home.
Above: The relationship of machine home to work home, otherwise know as work offset
Page 7
Work Offsets #1 6
These are the first G-Codes that were assigned to work Coordinates. This is how we tell the machine that
we are working on Part #1, Part #2, etc. thru Part #6. Originally no one thought we would need more
than 6 part offsets, but thru time and the invention of new types of machines, more were needed..
G110 G129
G154 P1-P99
These codes are the same as G54 to G59; they add more places as X & Y zero. We now can set up to 99
additional zeros within the travels of our machine.
MORE WORK COORDINATE SYSTEM SELECTION
Note: The G52 command works differently depending on the value of Setting 33. This setting
selects the FANUC, HAAS, or YASNAC style of coordinates, which are listed below.
G52 Global Work Coordinate Shift
G52 will shift all work offsets that are set in the machine. In the Work Offsets page of the control, if we
input a value of X +1.0000, ALL of the offsets will move one to the right by a value of 1.0000. This is most
commonly used in casting and forging work where we have core movement.
G53 Positioning In Regards to Machine Home (Non Modal)
G53 is used inside a program when we want to move the machine a certain distance and location from
Machine Home. This is quite often used if we want to establish a safe tool change position because we
have large parts or tools and need to clear the tool changer.
G92 Set Work Coordinate System
G92 Can be used to set our work offsets while on the fly in our program. G92 was used back when
machines only had one offset to choose from. We had to cut our first part, move the spindle over to the
second part X&Y zero, and then call G92 X0Y0 in our program. Our work offset is now set around the
second part. Using G54 G129 is much faster, more tunable, and easier to use.
Page 8
Page 9
Incremental Positioning:
With incremental positioning, we are telling the machine where to go in relationship to where it currently
is at. Basically like a set of directions given from where the machine stopped last.
G91 Incremental Positioning
Program to move the machine to the same
4 hole locations using G91 (Incr.)
X 1.0000 Y 1.0000
X 8.0000
Y 8.0000
X -8.0000
Page 10
Page 11
Objectives:
Upon completion of this unit, the student will:
1)
Understand the purpose or role of each alpha character involved in word address
programming.
2)
3)
4)
Page 12
Programming
A CNC Mill program is defined as a set of instructions given to the machine control to move the
positioning of the machine spindle, changes to the spindle RPM, and changes to the machines other
features (Tool Changes, Coolant System, Chip Control, etc)
Tool movements consist of rapid positioning commands, straight line movement of the tool at a
controlled speed, and movement along an arc.
The machine has three (3) linear axes named X, Y, and Z. The X-axis moves the table left and right, the Y
axis moves it to and from the operator, and the Z moves the milling head up and down. The machine zero
position is where the tool is at the right corner of the mill table farthest away from the front doors.
Motion in the X-axis will move the table to the right for negative numbers and to the left for positive
numbers. Motion in the Y-axis will move the table away from the operator for negative numbers and
toward the operator for positive numbers. Motion in the Z-axis will move the tool down for negative
numbers and up for positive numbers.
The optional fourth, or rotary, axis can be programmed for both rapid positioning commands and for feed
commands either by itself or in conjunction with the other axes.
In addition to the above, there may be up to five external axes that can be programmed for rapid or feed
motions, but only one axis at a time.
To accomplish all of these functions, we use machining G-Code often referred to as Fanuc G-Code or
ISO G-Code. This code is just a simple language. It is a simple language that consists of less than 300
words. As compared to English, Spanish, French, German, etc which contain thousands of words, but are
easily taught every day.
We are going to work with this language to train on Haas programming. In order to understand what a
program is doing, we need to talk about several subjects:
Word Address Assignments (The ABCs of CNC)
Spindle Commands
Tool Change Commands
Creating Tool Path with Linear and Circular Interpolation
G Code Definitions
M Code Definitions
Machine Defaults
Program Format
Canned Cycles and Hole Definition
Canned Cycle Modifiers (Bolt Hole Circles, Bolt Arcs, Lines of Holes)
Cutter Compensation
Circular Pocket Milling
Helical Motion and Thread Milling
Circular Plane Selection
Subprograms and Subroutines
Haas Pocket Milling Cycle (G150)
Haas Text & Serial Number Engraving
Page 13
The letter A is used to specify motion for the optional fourth, A, axis. It specifies an angle in degrees for
the rotary axis. We can assign a value of rotary motion between -8380.000 degrees, and 8380.000
degrees. Both positioning and simultaneous motion can be accomplished with a rotary axis. Normally the
A axis is designated as rotation around the X axis.
B
The letter B is used to specify motion for the optional fourth, B axis. It specifies an angle in degrees for
the rotary axis. We can assign a value of rotary motion between -8380.000 degrees, and 8380.000
degrees. Both positioning and simultaneous motion can be accomplished with a rotary axis. Normally the
B axis is designated as rotation around the Y axis.
C
The letter C is used to specify motion for the optional fourth, C axis. It specifies an angle in degrees for the
rotary axis. We can assign a value of rotary motion between -8380.000 degrees, and 8380.000 degrees.
This axis is an optional axis that is interfaced thru the control for positioning moves only. Normally the C
axis is designated as rotation around the Z axis.
D
Ds are used to define a tool diameter offset from the Tool Offset Page. We can choose a D value from D01
D200, which corresponds to the Geometry column in the Tool Offset Page. For example, D01=Tool
Offset Value Number 1, D02=Offset Number 2, etc..
E
CONTOURING ACCURACY
Es are used in conjunction with the G187 code that is Haas Specific. G187 is defined as Contouring
Control with machines that have the high speed machining option. G187 is used to control the machine
during high feed rates and control the acceleration / de-acceleration of the machines axis. The range of
values possible for the E code is 0.0001 to 0.25. Normally setting #85 is set to .005 and setting #191 is set
to medium on machines with the high speed machining option.
E is also used in the G47 Engraving Canned Cycle to prescribe the infeed rate in in/min.
F
FEED RATE
Fs are used to define the speed of the movement of the spindle as it travels. Typically used while the tool
is in the material, this is either defined as Inches Per Minute (IPM) or in Millimeters Per Minute (MMPM).
It is the distance that the machine would move in one minute (Example, F10.0 = 10 Linear IPM of Speed)
Page 14
G Codes establish Modes of Operation. When we define a G Code, think of it like we are flipping a rotary
switch on a TV to another mode (channel). For example, G83 is the code for Deep Hole Peck Drilling. We
tell the machine G83 and then tell the machine where the holes are located since we are in Drilling
Mode. When done, we take the machine out of Drilling Mode with a G80 which means Canned Cycle
Cancel. G codes are used to establish what Mode the machine is in.
H
The H is used to tell the machine what tool length value to use from the Tool Offset page. If we define
H01, we are telling the machine to use the value that is located under Tool Length #01. H02 = Tool Length
Value #2
I
The letter I is used two different ways. It can be used in canned cycles (Drilling Operations) and it is used
in defining arcs, in that we tell the machine incrementally from the start point of an arc, where the center
of the arc is. I is used to tell the machine how far away the center of the arc is in the X axis.
J
The letter J is used two different ways. It can be used in canned cycles (Drilling Operations) and it is used
in defining arcs, in that we tell the machine incrementally from the start point of an arc, where the center
of the arc is. J is used to tell the machine how far away the center of the arc is in the Y axis.
K
The letter K is used two different ways. It can be used in canned cycles (Drilling Operations) and it is used
in defining arcs, in that we tell the machine incrementally from the start point of an arc, where the center
of the arc is. K is used to tell the machine how far away the center of the arc is in the Z axis.
L
The L address character is used to specify a repetition count for some canned cycles and auxiliary
functions. It is followed by an unsigned number between 0 and 32767.
M
M codes are used to turn on and off functions specific to that of the machine. For example, M3 and M4
turn the spindle on, M5 turns the spindle off. M8 turns coolant on, M9 off. Think of it like M means
Machine Function.
N
NUMBER OF BLOCK
The N address character is entirely optional. It can be used to identify or number each block of a program.
It is followed by a number between 0 and 99999. The M97 functions may reference an N line number.
Page 15
PROGRAM NUMBER/NAME
The O address character is used to identify a program. It is followed by a number between 0 and 99999.
A program saved in memory always has an Onnnnn identification in the first block; it cannot be deleted.
Altering the O in the first block causes the program to be renamed. A program can only have one O
address.
P
P is another dual function letter in that it can be used to define a pause with a G04 code, or it is used with
a M97 or M98 code to tell the machine to jump from its current place in a program to another place in
the program (in the case of M97 P100 = Jump to line N100) or to another program entirely (with M98
P520 = Jump to program O520). A length of a pause can be defined two different ways, in Seconds (with a
decimal point) or Milliseconds (without a decimal). G4 P.1 would mean wait .1 seconds, and G4 P100
(without a decimal) would mean wait 100 Milliseconds. Both .1 Seconds and 100 Milliseconds are the
same amount of time.
Q
The letter Q is used in canned cycles, most often as the Peck distance in a drilling cycle.
R
R is another dual role character. It can be used in canned (drilling) cycles to define the Rapid Plane (how
far above the part to rapid the tool to), or it is used I defining an arcs radius (replacing the I, J, and K
method). Refer to the Line and Arc Interpolation Section of this manual for more detail.
S
S defines the spindle rpm. We can use a value anywhere between S0 S99999. If we define a speed
higher than the capacity of the machines spindle, it will max out the machines RPM and start cutting. For
example, a standard VF spindle is 7,500 RPM. If we tell the machine S15000 M03 (turn on the spindle
forward at 15,000 RPM) the machine will go to the 7,500 and start cutting. Be aware of your machines
capabilities (4k, 7.5k, 10k, 12k, 15k or 30k) before programming speeds and feeds.
T
A standard Haas VMC can be equipped with a 10, 20, 24, 30, 40, etc. Tool Changers, but the control has
the capability of saving in its memory up to 200 Tools. It is possible to STORE tool number 121 in a
machine that only has a 24-tool Tool Changer. A T code tells the machine what tool we want to put in the
spindle. *NOTE* on Haas machines with a side mount tool changer (Tool are stored randomly in the
magazine) a Tool Pre-Call may be necessary to Stage the tool change.
Page 16
The X address character is used to specify motion for the X-axis. It specifies a position or distance along
the X-axis. It is either in inches with four fractional positions or mm with three fractional positions. It is
followed by a signed number in inches between -8380.000 and 8380.000 or between -83800.00 and
83800.00 for metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or
1/1000 mm.
Y
The Y address character is used to specify motion for the Y-axis. It specifies a position or distance along
the Y-axis. It is either in inches with four fractional positions or mm with three fractional positions. It is
followed by a signed number in inches between -8380.000 and 8380.000 or between -83800.00 and
83800.00 for metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or
1/1000 mm.
Z
The Z address character is used to specify motion for the Z-axis. It specifies a position or distance along
the Z-axis. It is either in inches with four fractional positions or mm with three fractional positions. It is
followed by a signed number in inches between -8380.000 and 8380.000 or between -83800.00 and
83800.00 for metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or
1/1000 mm.
Page 17
Page 18
Page 19
Code:
G00
G01
G02
G03
G04
G09
G10
G12
G13
G17
G18
G19
G20
G21
G28
G29
G31
G35
G36
G37
G40
G41
G42
G43
G44
G47
G49
G50
G51
G52
G52
G52
G53
G54
G55
G56
G57
G58
G59
G60
G61
G64
G65
G68
G69
Group:
*01
01
01
01
00
00
00
00
00
*02
02
02
06
06
00
00
00
00
00
00
*07
07
07
08
08
00
*08
11
11
12
00
00
00
*12
12
12
12
12
12
00
13
*13
00
16
16
Function:
Rapid Motion
Linear Interpolation Motion
CW Interpolation Motion
CCW Interpolation Motion
Dwell
Exact Stop (non-modal)
Programmable Offset Setting
CW Circular Pock Milling (Yasnac)
CCW Circular Pock Milling (Yasnac)
XY Plane Selection (circular interpolation)
ZX Plane Selection (circular interpolation)
YZ Plane Selection (circular interpolation)
Inch Programming Selection
Metric Programming Selection
Return to Machine Zero through Reference Point
Move to Location through G28 Reference- never used
Skip Function (used in probing)
Automatic Tool Diameter Measurement (probing)
Automatic Work Offset Measurement (probing)
Automatic Tool Length Measurement (probing)
Cutter Comp Cancel
Cutter Compensation Left
Cutter Compensation Right
Tool Length Compensation
Tool Length Compensation (never used)
Engraving
G43/G44 Cancel
G51 (scaling) Cancel
Scaling (option)
Select Work Coordinate System G52 (global work shift) (Yasnac)
Set Local Coordinate System (Fanuc)
Set Local Coordinate System (HAAS)
Non-Modal Machine Coordinate Selection
Select Work Coordinate System l
Select Work Coordinate System 2
Select Work Coordinate System 3
Select Work Coordinate System 4
Select Work Coordinate System 5
Select Work Coordinate System 6
Unidirectional Positioning (never used)
Exact Stop Modal
G61 Cancel
Macro Subroutine Call (used in conjunction with P value)
Rotation (option, comes with probing)
G68 Cancel
Page 20
Code:
Group:
Function:
G70
00
Bolt Hole Circle (Yasnac)
G71
00
Bolt Hole Arc (Yasnac)
G72
00
Bolt Holes Along an Angle (Yasnac)
G73
09
High Speed Peck Drill Canned Cycle
G74
09
Reverse Tap Canned Cycle
G76
09
Fine Boring Canned Cycle
G77
09
Back Bore Canned Cycle
G80
*09
Canned Cycle Cancel
G81
09
Drill Canned Cycle
G82
09
Spot Drill Canned Cycle
G83
09
Peck Drill Canned Cycle (for deep holes)
G84
09
Tapping Canned Cycle
G85
09
Boring Canned Cycle
G86
09
Bore/Stop Canned Cycle
G87
09
Bore/Manual Retract Canned Cycle
G88
09
Bore/Dwell Canned Cycle
G89
09
Bore Canned Cycle
G90
*03
Absolute positioning
G91
03
Incremental positioning
G92
00
Set Work Coordinates - FANUC or HAAS
G92
00
Set Work Coordinates - YASNAC
G94
05
Feed per minute
G95
05
Feed per revolution
G98
*10
Initial Point Return
G99
10
R Plane Return
G100
00
Disable Mirror Image
G101
00
Enable Mirror Image (comes with probing)
G102
00
Programmable Output to RS-232
G103
00
Block Look ahead Limit (used in conjunction with P value)
G107
00Cylindrical Mapping
G110-G129
Select Coordinate System 7 thru 26,
group 12
G154 P1-P99
Select Coordinate System 7 thru 106 (Newer Machines) group 12
G136
00
Automatic Work Offset Center Measurement
G150
00
General Purpose Pocket Milling
G187
00
Accuracy Control for High Speed Machining
Page 21
Stop Program
The M00 code is used to stop a program. It also stops the spindle and turns off the coolant and
stops interpretation look ahead processing. This is used to force the operator to interact with the
machine (such as check a dimension, flip a part over, blow chips from a hole to tap, etc)
M01
M03
Spindle Forward
The M03 code will start the spindle moving in a clockwise direction at whatever speed was
previously set. The machine will stop and wait for acceleration of the spindle to full speed prior to
moving to ensure the spindle is ready to make a cut.
M04
Spindle Reverse
The M04 code will start the spindle moving in a counterclockwise direction at whatever speed was
previously set.
M05
Spindle Stop
The M05 code is used to stop the spindle. The block is delayed until the spindle slows below 10
rpm.
M06
Tool Change
The M06 code is used to initiate a tool change. The previously selected tool (Tn) is put into the
spindle. If the spindle was running, it will be stopped. No previous axis commands are required
before the tool change unless there is a problem with tool/part/fixture clearance. The Z-axis will
automatically move up to the machine zero position and the selected tool will be put into the
spindle. The Z-axis is left at machine zero. The spindle will not be started again after the tool
change but the Snnnn speed and gear will be unchanged. The Tnn must be in the same block or in
a previous block. The coolant pump will be turned off during a tool change and a air purge will
open to keep chips out of the spindle.
M08
Coolant On
The M08 code will turn on the coolant supply. Note that the M code is performed at the end of a
block so that if a motion is commanded in the same block, the coolant is turned on after the
motion. The low coolant status is only checked at the start of a program so that a low coolant
condition will not stop a program which is already running.
Page 22
M09
Coolant Off
The M09 code will turn off the coolant supply.
M10
M11
M16
Tool Change
The M16 code is used to initiate a tool change. In the present machine configuration, M16 works
exactly like M06. (normally not used)
M19
Orient Spindle
The M19 code is used to orient the spindle to a fixed position. This command leaves the spindle in
that position and locked. The next spindle motion command (Snnnn, M3, M4, M41, or M42) will
unlock the spindle.
M31
M32
M33
Page 23
M34
M35
M39
M41
M42
M76
Disable Displays
This code is used to disable the updating of the screen displays during high speed machining. It is
used to increase the speed of the central processing unit in the controls of the Haas machine tool.
M77
Enable Displays
This code is used to enable the updating of the screen displays at the end of high speed
machining.
Page 24
M80
M81
M82
Tool Unclamp
This code is used to release the tool from the spindle. It is not normally needed since tool change
operations do this automatically and a manual TOOL RELEASE button is available to the operator.
This M code is not recommended for use since the tool will be dropped from the spindle and may
damage the tool, the machine, or your setup.
M83
M84
M86
Tool Clamp
This code will clamp a tool into the spindle. It is not normally needed since tool change operators
do this automatically and a manual TOOL RELEASE button is available to the operator.
M88
M89
tool
M95
M97
M98
M99
Page 25
Objectives:
Upon completion of this unit, the student will:
1)
Be familiar with the proper sequence of events that should be followed when developing a CNC
program.
2)
Be able to define Safety Line and be familiar with the codes it contains.
3)
Understand critical information that must be included before and after each tool.
4)
Be capable of following an existing program and explain the sequence of events that it follows.
5)
Page 26
Program Format
Program format, or style, is an important part of CNC machining. Each individual will have their own way
to format their programs differently but in most cases, a programmer could not identify a program
written by them 6 months after they wrote it. The point is that a programmer needs to be consistent and
efficient by writing code in the way it is listed and in the order it appears in the program. For example: X,
Y, Z, should be written in order of appearance. The machine will read X, Y, or Z in any order, but we want
to be consistent. Write X first, Y second, Z third. This will help ensure confidence and trust between you
the programmer and others who may use the program.
We should start any program with a safety line even though it may be redundant, we want to put our G
Code Switches (Grouping of G Codes) in the position we intend on using them at the start of our program.
G00 puts machine in a rapid mode. G17 selects the X-Y plane for circular interpolation. G40 cancels cutter
compensation. It is a good idea to cancel Tool Length Comp (G49). G80 cancels any canned cycles. G90
puts machine in absolute. G98 instructs machine to return to initial start point in any canned drill cycles.
This will FORCE the machine into what we want it to do. We do not want to assume the machine is already
set the way we want it.
G00 G17 G40 G49 G80 G90 G98 (SAFETY LINE)
The next line we want to return to machine zero in Z, the tool index position.
G28 G91 Z0 or (G00 G53 Z0)
The next line we want to enter is a tool change. The correct tool may be in the spindle already, and we
dont need to do a tool change to run our part, but the next time we start our program, that tool may not
be in the spindle. Force the machine to put the tool we want in the spindle. Never assume it is already
there.
T1 M06 (LOAD TOOL 1)
The fourth line or block will contain a rapid command (G00), an absolute or incremental command (G90,
G91), a work zero for X and Y (G54), a positioning X and Y coordinate, a spindle speed command (S---), and
a spindle ON clockwise command (M03).
G0G90G54 X______Y_____S_____M03 (RAPID, ABSOLUTE, OFFSET #1, SPINDLE ON)
The next line will contain a "read tool length compensation" command (G43); a tool length offset number
(H0l ), a Z-axis positioning move (Z.1), and an optional coolant ON command (M08).
G43 H01 Z1.0 M08 (TOOL LENGTH COMP OFFSET #1, GO TO Z1.0, TURN COOLANT ON)
An example program's first five lines will look like this:
G00 G17 G40 G49 G80 G90 G98;
G00 G53 Z0;
T1 M06;
G00 G90 G54 X0 Y0 S2500 M03;
G43 H01 Z1.0 M08;
All the necessary code is listed above for each approach we will make towards the part. There are several
variations on the above code that will work and net the same results, and it is up for you to decide what
you like best, but once you do, stay with it and be consistent!
Productivity Inc - Haas CNC Mill Programming Manual
Page 27
QUESTION: If G00, G90, and G54 are defaults, why do we list them in the second line of a program and for
each different tool?
ANSWER: G00, G90, and G54 are listed for an operator/setup person's aid so he/she can determine if the
machine will rapid position, if the machine is in fact in the absolute coordinate mode, and most important,
the work zero. The work zero is always different between setups, and multiple work zeros are very
common.
QUESTION: Can we combine the third and forth lines excluding the M08 code? If so, why do we write the
lines separately?
ANSWER: Yes. The four G codes G00, G90, G54, and G43 all belong to different groups. Remember, no
two G codes of the same group can be listed on the same line.
The main reason for using two lines is SAFETY. Remember, only one line of information can be executed
at a time. The X and Y coordinates will position first and then the tool length and the Z coordinate move
will be executed. If combined, all three axes will move simultaneously, and any interfering clamps or
fixtures can be struck and/or destroyed. Combining an X, Y, and Z move together will increase the chance
of crashing the machine.
Machine Defaults
When we first power up the control, the machine loads it software and parameters, and the machine
needs to go to some sort of base settings as far as our G-Codes are concerned. The switches have to be
turned to some sort of position, and we call these the defaults.
The control automatically reads these G codes when power is turned on:
G00
G17
G40
G49
G54
G64
G80
G90
G98
Rapid traverse
X, Y Circular plane selection
Cutter Compensation cancel
Tool length compensation cancel
Work coordinate zero #1 (1 of 109 available)
Exact stop cancel
Canned cycle cancel
Absolute programming
Initial point return
There is no default FEED RATE (F code), but once an F code is programmed, it will apply until another is
entered or the machine is turned off.
The spindle is also set to a speed of 0 RPM when first turned on, so a S command is needed in order to
turn on the spindle even in manual mode.
Page 28
=
=
=
=
=
=
=
and so on. But our machine control only understands these messages when given in machine code.
Why do we use G&M Code and not a different language (English for example)?
CNC Machines were first built in the 1940s and 50s with the invention of computers. They were custom
built, and several companies were trying to come to market with the first consumer available NC machine
tools.
It was the early 60s before CNC machines became commercially available, and not only was the machine
invented, so was the computer, and the software to run the computer. These first computers were limited
and didnt have enough memory to remember an entire language such as English. So Code had to be
invented, and was limited to words that had one letter and two numbers behind it (G 0 0 for Example).
Several inventors came out with machine and controls in the early days, and each one had to invent their
own code. Soon there were several brands and several different kinds of code. This is when the ISO
(International Standards Organization) said they were going to set a Standard code. They went with the
code that was by far the most popular at the time, FANUC. This is why it is also referred to as Fanuc GCode
The basics of this code remain the same to this day. Things get added from time to time, and it just adds
new codes to the end of the G-Code list. Last code invented was G187 Machine Accuracy Control, and
came out in the late 1990s. The first G-Codes were G00, G01, G02, and G03. They were established in the
50s. As a new need for a new machine mode is invented, new G-Codes will get added on to the list.
Why do we stick with the code since technology has come so far?
Standardization and Familiarity: It has been a great benefit in many ways. Operators and programmers
trained on one machine can move to another brand, control, shop, etc and with a little familiarization
can get up to speed quickly. Companies can share programs.
Page 29
Program Structure
In the CNC world, the term Block is used to define what we know as a line of code. The reason it is
called a block is that the machine can read the entire line all at once, not from left to right as we are used
to. A typical program consists of one or more blocks of commands.
After each block we need to end the block with a semi-colon (;). On the operators panel, the EOB key (End
of Block) will generate this symbol. This is how the machine tells one line of code from the next.
The " / " symbol, sometimes called a forward slash, is used to define an optional block. A block that
contains this symbol can be optionally deleted when the machine is in the block delete mode (BLKDEL)
when running a program.
The machine does not read left to right as we do, again it takes a whole block in at one time. We can
arrange our G-Codes, M-Codes, and Alphabetic Address Codes (X, Y, Z, etc..) in any order we want. The
rules are we can have one (G-Code) from each group, only one (M-Code), and alpha characters on each
line. The machine will ALWAYS run the G-Codes and alpha characters first and the M-Code last.
PROGRAM START-UP LINES
G00 G17 G40 G49 G80 G90 G98
G00
G17
G40
G49
G80
G90
G98
(Safety Line)
Rapid
Selects X-Y Work Plane
Cancels Cutter Comp
Cancels Tool Length Offset
Cancels Canned Cycle
Absolute
Initial Point Return for canned cycles
G91 G28 Z0
(G00 G53 Z0)
G28
T1 M06
T1
M06
G43
H01
Z.1
M08
Page 30
G00
Z1.
M09
G49
M5
G53
G28 G91 Y0
(G53 Y0)
G91
Z0.
Y0
M30
M30
Signals END OF PROGRAM AND REWIND to the control. The program will
reset to the first block of the program and stop. It also stops the spindle,
turns off the coolant and cancels tool length offsets. It also makes the
control ready for the next cycle.
Now with our numbers we need to input, we are somewhat limited when we go past the decimal, and
there are some unique ways of programming. In the early days, the controls didnt have enough memory
or smarts to even allow for a decimal, so all values were entered in what is called an 8 character
assignment. All numbers had to have 8 numbers, 4 in front of the decimal, 4 behind:
10.000 = 00100000
1.0000 = 00010000
.0010 = 00000010
.0003 = 00000003
As controls got smarter, they eventually were able to integrate a decimal into the machines. But, the
above programming method is still viable. With that said, when we are entering a whole unit (such as 1
inch) we need to input the decimal (1 inch should be 1.0). If we input the number one, with no decimal
behind it, the machine will read it as .0001, and one tenth of one thousandth is a long way away from 1.0
Page 31
Objectives:
Upon completion of this unit, the student will:
1)
2)
3)
Understand the principles of programming and applications with and without cutter
compensation and the advantages and disadvantages of each.
4)
Be capable of producing a tool path program, containing lines and arcs, with and without cutter
compensation.
5)
Be capable of determining feeds and speeds given an SFM and cutting tool, and be capable of
determining feed rate given an RPM and chip load.
6)
7)
8)
Have a basic understanding of the concept of arc in/arc out and some of its applications.
Page 32
This G code is for rapid traverse of the axes of our machine. The human mind thinks point to point, and as
in the example below, we will move from X-3.0 Y-1.0 to X2.25 Y1.25 and we want to think the machine will
move strait or as the crow flies. The code G00, means MOVE AS FAST AS POSSIBLE, which means move
all axis at full speed. Since all of the axis will move at the same speed, the machine will make a 45 degree
move till it achieves the position in one axis (Y in the example below) and finish the other till the point is
achieved.
If we need to move in a strait line, the machine will only move in a strait line when told so, and that is
what G01 is for.
Page 33
Interpolation Commands
G01 Linear Interpolation Commands
F
X
Y
Z
A
This G code provides for straight-line (linear) motion from point-to-point. Motion can occur in 1, 2 or 3
axes at a time. All our axes start and finish motion at the same time, including rotary axes.
The speed of all axes is controlled by a feed rate specified along with axis moves. Rotary axis feed rate is
dependent on the rotary axis diameter setting (Setting 34) and will provide a controlled motion. The F
command is modal and may be specified in a previous block. Only the axes specified are moved in either
absolute (G90) or incremental (G91) modal commands, which change how values are interpreted.
Page 34
Circular interpolation commands are used to move a tool along a circular arc to the commanded end
position.
Five pieces of information are required for executing a circular interpolation command:
1)
2)
3)
4)
5)
Plane selection
Arc start position coordinates
Rotation direction
Arc end position coordinates
Arc center coordinates or arc radius.
1 Plane Selection The machine is capable of cutting an arc on different axes, basically meaning which
two ball screws need to turn to achieve the desired arc. If we want a arc cut parallel to the top of the table
of the machine (using the X & Y ball screws), we use a code called G17 (X&Y Plane Selection) to do so.
NOTE* G17 is a machine default, and is the most common setting. If we need to cut a arc along the left to
right of the machine, down towards the table of the machine (using the X & Z ball screws) then we use the
code G18. If we are going to cut an arc town towards the table along the front to rear of the machine
(using the Y & Z) then we use G19.
2 Arc Start Position This is as simple as the position of the last move prior to the arc.
3 - Arc Direction This is why we define G02 or G03, Clockwise vs. Counter Clockwise from the start
point. This is defined as the way the tool is looking at the arc, not necessarily the way you are looking at it
on the machine.
Page 35
4 Arc End Co-Ordinates This is where we want the arc to end. We define the end point of the arc in
either G90 or G91, and we can use up to 3 axis to do so.
5 Center of Arc Location I, J, and K method or R method
I,J,K are used to define the distance from our known Start Point of our arc to the center of the arc. I = the
incremental distance in X, J = the incremental distance in Y, and in the case of G18 and G19, K = the
incremental distance in Z. All of these values tell the machine our arc hinges on a point so far from the
arc start point.
R method enables the machine to find the location on its own. In our arc command line we define the end
point, then tell the machine to maintain a certain radius between the points. The R method will work on
arcs from 0 359.9999 degrees. If it is a full circle, we use I,J,K
Either system is valid. The R method arrived after machines were smart enough to calculate an arc.
The START POINT is defined prior to the G02 line, usually by a G01 linear positioning move.
The END POINT is defined by the X and Y coordinates within the G02 line when in the G17 XY PLANE.
The ARC CENTER is defined in the G02 line by the I and J values, when in the G17-XY PLANE, or by a
R value. Note the above will cut a .500 radius on the part.
Page 36
To cut a complete circle of 360 degrees, program I, J, or K to define the center of the circle. You
do not need to specify X, Y, or Z as an ending point. The following line will cut a complete circle:
G02 I-2.5
Page 37
Page 38
Page 39
Page 40
Interpolation Exercise
Cutter will be a .500 diameter end mill. Start contour from the lower left corner of part and mill around
outside of part .375 deep. To position around the part, mill around outside of part with tool by defining
the very center of the cutter.
Page 41
The mathematical computations for determining a tool path are greatly simplified.
2)
The part, and not the tool center, is programmed. Therefore, the same program can be used
for a variety of different cutter diameters.
3)
The same program path can be used for roughing, as well as finishing cuts, by using different
cutter offsets.
4)
A cutter compensation command (G41 or G42) must be on the same block with an X and/or Y
linear move when ramping on to the part using cutter compensation.
2)
3)
Cancel of cutter compensation command (G40) must be on the same block with an X and/or
Y linear move when ramping off the part using cutter compensation.
Position our tool at a X & Y location that is off of our part with enough room to allow us to
move from un-compensated to fully compensated, at least our tool diameter.
2)
3)
From our position in (1) above, program a X & Y location that would put us exactly on the
profile that we are trying to cut. Then include a G41 (LH) or a G42 (RH) compensation
command to tell the machine what side of the profile to keep the tool on. Also include the D
number of your tool. This move has to as large or larger than the amount of offset (radius)
that we are compensating for.
Page 42
2)
DO NOT cancel cutter compensation on any line that is still cutting the part.
3)
4)
Cancel of cutter compensation (G40) may need values entered for both X and Y axis. This
may need to be done to ensure that both axes will position to the location you want or
remain fixed and not move during the cancel (G40) process. This is a programming technique
that may be a programmers preference.
5)
Linear move equal to or greater than the amount being compensated for (radius of the tool).
G41
G42
Page 43
Dnn Cutter Compensation Value The actual offset amount must be input in the specified tool offset
display number. On the HAAS you have 200 tool offsets to use. Usually, you will have only one cutter
offset for a tool, and it is best to use the same cutter offset number as is the tool number. The cutter
GEOMETRY column, in the offset display, is to set the initial cutter offset value. It can be designated as
either a DIAMETER value or a RADIUS value by selecting the one you would like to use with SETTING 40.
The selection chosen will be listed at the top of the offset geometry column. The WEAR column on the
right of the tool GEOMETRY column is for any adjustments needed to make the initial tool GEOMETRY
offset. These values are added together by the control and used as one value.
Understanding cutter compensation can be simplified if one has a basic understanding of manual
machining. There are two common types of cutting conditions associated with milling machines:
1)
CLIMB
2)
CONVENTIONAL
Two common rules for these types of cuts are:
If the programmed cutter path needs to mill CLIMB cutting and it is a standard right handed tool,
it will then be programmed with G41 cutter LEFT of the programmed path.
If the programmed cutter path needs to mill with CONVENTIONAL cutting and it is a standard
right handed tool, it will then be programmed with the G42 cutter RIGHT of the programmed
path.
Program without cutter compensation:
G00 X-2.35 Y-2.
G01 Z-.45 F10
X-2.25
Y1.5
G02 X-1.5 Y2.25 R.75
G01 X1.5
G02 X2.25 Y1.5 R.75
G01 Y-1.5
G02 X1.5 Y-2.25 R.75
G01 X-1.5
G02 X-2.25 Y-1.5 R.75
G01 X-2.25
Page 44
Program with cutter compensation (Diameter value for D01 would be .500 entered into diameter offset
register #1):
G00
G01
G41
Y1.5
G02
G01
G02
G01
G02
G01
G02
G40
X-2.35 Y-2.0
Z-.45 F10
X-2. D01 (turn on CC with an X and/or Y move)
X-1.5 Y2. R.5
X1.5
X2. Y1.5 R.5
Y-1.5
X1.5 Y-2. R.5
X-1.5
X-2. Y-1.5 R.5
G01 X-2.35 (turn off CC with an X and/or Y move off part)
Page 45
When programming without cutter compensation to the center of the cutter, a problem occurs cutting
angle geometry. The cutter center must be offset to the part geometry to maintain the cutter tangency.
For example, the Y-axis move from Point A to Point B must have the Delta Y calculated dimension
added to the .75 dimension. The X-axis move from Point B to Point C must have the Delta X calculated
dimension subtracted from the 1.25 dimension.
Page 46
Cutter will be a diameter End Mill; Mill around outside contour of part .375 deep using Cutter
Compensation.
O0020
G00 G17 G40 G49 G80 G90 G98
G00 G53 Z0
T1 M06 (1/2 Diameter 4 flute. End Mill)
G90 G54 G00 X______ Y_____ S1000 M03
G43 H01 Z.1 M08
G01 Z_____ F50.
G__ X______ D_____ F10. (turn on cutter compensation)
Y______
G0_ X______ Y_____ R_____
G0_ X______
G0_ X______ Y_____ R_____
G0_ Y______
G0_ X______ Y_____ R_____
G0_ X______
G__ X______ Y_____ (turn off cutter compensation)
G00 Z1. M09
G00 G53 Z0 M05
G00 G53 Y0
M30
Page 47
Page 48
Page 49
Page 50
Objectives:
Upon completion of this unit, the student will:
1)
2)
Be familiar with common canned cycles, their variables, the proper applications, and the correct
deployment of them.
3)
Page 51
Canned Cycles
A canned cycle is used to simplify programming of a part. Canned cycles are defined for the most
common Z-axis repetitive operations such as drilling, tapping, and boring. There are 13 canned cycles to
choose from. Once selected, a canned cycle is active until canceled with G80.
There are five operations involved in every canned cycle:
1)
positioning of X and Y axes (and optional A),
2)
rapid traverse to R plane,
3)
drilling, tapping and boring,
4)
operation at bottom of hole,
5)
retraction to R plane.
Once a Canned Cycle code is turned on, every time we move to a new X & Y location the machine will drill
a hole. This will continue until we cancel the drilling with a G80 code. This is how canned cycles save time.
If we had 100 holes in a part, we would save 6000 lines of code in the example above.
Canned cycles are presently limited to only operations in the Z-axis. That is, only the G17 X-Y plane is
allowed. This means that the canned cycle will be executed in the Z-axis whenever a position is selected
in the X or Y axes. The operation of a canned cycle will vary according to whether incremental (G91) or
absolute (G90) is active.
G98 and G99 are modal commands that change the way canned cycles 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.
Page 52
The following is a summary of the canned cycles defined for the VF Series Mill:
G
Code
G73
G74
G76
G77
G81
G82
G83
G84
G85
G86
G87
G88
G89
Z Drilling
Direction
Intermittent Feed
Feed
Feed then Stop
Rapid to Bottom
Feed
Feed
Intermittent Feed
Feed
Feed
Feed
Feed
Feed
Feed
Operation at Bottom of
Hole
None
Spindle CW
Orient Spindle
Orient Spindle
None
Dwell
None
Spindle CCW
None
Spindle Stop
Spindle Stop
Dwell, then Spindle Stop
Dwell
Retraction
Z Direction
Rapid
Feed
Rapid
Back Bore/Rapid
Rapid
Rapid
Rapid
Feed
Feed
Rapid
Manual/Rapid
Manual/Rapid
Feed
Application
High Speed Peck Drilling
Left Hand Tapping
Fine Boring
Back Boring
Spot Drilling
Counter Boring
Peck Drilling
Tapping Cycle
Boring Cycle
Boring Cycle
Back Boring
Boring Cycle
Boring Cycle
Incremental motion in a canned cycle is often useful as a loop (L) count, which can be used to repeat the
operation with an incremental X or Y move between each cycle.
NOTE: If an L0 is in the canned cycle line, the cycle will not execute until the control reads the next
X or Y location.
The G80 code is used to cancel a canned cycle. In addition to this, a G00 or G01 code will also cancel any
active canned cycle.
Once a canned cycle is defined, the canned cycle is repeated at every X-Y position in sequential blocks.
Some of the canned cycle numerical values can also be changed after the canned cycle is defined. The
most important of these are the R plane value and the Z depth value.
If these are changed in a block with an X-Y, the change doesnt take effect until the next block. All
subsequent blocks are performed with the new R or Z value.
Changes to the G98/G99 selection can also be made after the canned cycle is active. If changed, the new
G98/G99 value will be active in the next block and all subsequent blocks.
Page 53
N1
N2
N3
N4
N5
N6
N7
N8
N9
T1 M06
G90 G54 G00 X.3 Y.3
S1200 M03
G43 H01 Z1. M08
G81 Z-.6 R.1 F10.
X1.2 Y1.2
G80 G00 Z1. M09
G28 G91 Z0. M05
M30
This G code is modal in that it activates the canned cycle until it is canceled or another canned cycle is
selected. Once activated, every motion of X or Y will cause this canned cycle to be executed.
Page 54
N1
N2
N3
N4
N5
N6
N7
N8
N9
T1 M06
G90 G54 G00 X.3 Y.3
S1200 M03
G43 H01 Z1. M08
G82 Z-.125 P1.5 R.1 F10.
X1.2 Y1.2
G80 G00 Z1. M09
G91 G28 Z0. M05
M30
This G code is modal in that it activates the canned cycle until it is canceled or another canned cycle is
selected. Once activated, every motion of X or Y will cause this canned cycle to be executed.
Page 55
N1 T1 M06
N2 G90 G54 G00 X.3 Y.3
N3 S1200 M03
N4 G43 H01 Z1. M08
N5 G83 Z-.6 Q.10 R.1 F10.
N6 X1.2 Y1.2
N7 G80 G00 Z1. M09
N8 G91 G28 Z0. M05
N9 M30
This G code is modal in that it activates the canned cycle until it is canceled or another canned cycle is
selected. Once activated, every motion of X or Y will cause this canned cycle to be executed.
If I, J, and K are specified, a different operating mode is selected: 1) The first pass will cut in by I; and 2)
each succeeding cut will be reduced by amount J with a minimum cutting depth of K.
If Q is specified, the machine will incrementally peck till full depth is achieved.
Page 56
Page 57
Page 58
Page 59
N1
N2
N3
N4
N5
N6
N7
N8
N9
T1 M06
G90 G54 G00 X.3 Y.3
S1200 (you do not need to turn spindle on)
G43 H01 Z1. M08
G84 Z-.85 R.1 F60.
X1.2 Y1.2
G80 G00 Z1. M09
G91 G28 Z0. M05
M30
This G code is modal in that it activates the canned cycle until it is canceled or another canned cycle is
selected. Once activated, every motion of X or Y will cause this canned cycle to be executed. When rigid
tapping is used, the ratio between the feed rate and spindle speed must be precisely the thread pitch
being cut.
You do not need to start the spindle CW before this canned cycle. The control does this automatically.
Setting 130 Tap Retract Speed (Allows retract to be two to four times faster)
Setting 133 Repeat Rigid Tap (Allows holes to be re-tapped)
Page 60
N1
N2
N3
N4
N5
N6
N7
N8
N9
T1 M06
G90 G54 G00 X.3 Y.3
S1200 M03
G43 H01 Z1. M08
G85 Z-.6 R.1 F10.
X1.2 Y1.2
G80 G00 Z1. M09
G91 G28 Z0. M05
M30
This G code is modal in that it activates the canned cycle until it is canceled or another canned
cycle is selected. Once activated, every motion of X or Y will cause this canned cycle to be
executed.
Page 61
Page 62
Page 63
N3 (1/2 - 13 TAP)
T___ M___
G___ G___ G___ X____ Y____ S_____
G___ Z____ H___ M___
G___ Z-____ R____ F____
X_____
X_____
X_____Y_____
X_____
X_____Y_____
X_____
X_____
G___ G___ Z____ M___
G___ G___ Z____
G___ G___ Y____
M___
Page 64
N1
N2
N3
N4
N5
N6
N7
N8
N9
T1 M06
G90 G54 G00 X.3 Y.3
S1200 M03
G43 H01 Z1. M08
G89 Z-.6 P1.0 R.1 F10.
X1.2 Y1.2
G80 G00 1Z M09
G91 G28 Z0. M05
M30
This G code is modal in that it activates the canned cycle until it is canceled or another canned cycle is
selected. Once activated, every motion of X or Y will cause this canned cycle to be executed.
Page 65
N1
N2
N3
N4
N5
N6
N7
N8
N9
T1 M06
G90 G54 G00 X.3 Y.3
S1200 M03
G43 H01 Z1. M08
G73 Z-.6 Q.25 R.1 F10.
X1.2 Y1.2
G80 G00 Z1. M09
G91 G28 Z0. M05
M30
This G code is modal in that it activates the canned cycle until it is canceled or another canned cycle is
selected. Once activated, every motion of X or Y will cause this canned cycle to be executed. This cycle is
a high speed peck cycle where a retract distance is set by Setting 22.
I, J, K, and Q are always positive numbers.
Setting 52 also changes the way G73 works when it returns to the R plane. Most programmers set the R
plane well above the cut to ensure that the chip clear motion actually allows the chips to get out of the
hole, but this causes a wasted motion when first drilling through this empty space. If Setting 52 is set to
the distance required to clear chips, the R plane can be put much closer to the part being drilled. When
the clear move to R occurs, the Z will be moved above R by this setting.
If I, J, and K are specified with G73, a different operating mode is selected. The first pass will cut in by I,
each succeeding cut will be reduced by amount J with a minimum cutting depth of K.
If K and Q are both specified, a different operating mode is selected for this canned cycle. In this mode,
the tool is returned to the R plane after a number of passes totals up to the K amount. This allows much
faster drilling than G83, but still returns to the R plane occasionally to clear chips.
Productivity Inc - Haas CNC Mill Programming Manual
Page 66
N1
N2
N3
N4
N5
N6
N7
N8
N9
T1 M06
G90 G54 G00 X.3 Y.3
S1200
G43 H01 Z1. M08
G74 Z-.6 R.1 F60.
X1.2 Y1.2
G80 G00 Z1. M09
G91 G28 Z0. M05
M30
This G code is modal in that it activates the canned cycle until it is canceled or another canned cycle is
selected. Once activated, every motion of X or Y will cause this canned cycle to be executed. Note that
operation of this cycle is different if the rigid tapping option is installed and selected. When rigid tapping
is used, the ratio between the feed rate and spindle speed must be precisely the thread pitch being cut.
You do not need to start the spindle CCW before this canned cycle. The control does this automatically.
Page 67
G76 Fine Boring Canned Cycle (feed down, spindle stop, orient spindle, step over, rapid out)
F
I
J
P
Q
R
X
Y
Z
N1
N2
N3
N4
N5
N6
N7
N8
N9
T1 M06
G90 G54 G00 X.3 Y.3
S1200 M03
G43 H01 Z1. M08
G76 Z-.6 R.1 F10. Q.02
X1.2 Y1.2
G80 G00 Z1. M09
G91 G28 Z0. M05
M30
This cycle will shift the X and/or Y-axis prior to retracting in order to clear the tool while exiting the part.
This shift direction is set by Setting 27.
The Q value distance will shift in the direction set by Setting 27. If Q is not specified, the optional I and J
values are used to determine the shift direction and distance.
Page 68
Page 69
NOTE: The sequence of drilling used here is designed to save time and to follow the shortest path from
hole-to-hole.
Page 70
Page 71
The tool must be positioned at the center of the circle either in a previous block or in the G70 block. G70
belongs to Group zero and thus is non-modal. For a G70 to work correctly, a canned cycle should be active
so that at each of the positions, some type of drill or tap cycle is performed.
G71 Bolt Hole Arc
I
J
K
L
Radius
Starting angle (degrees CCW from horizontal)
Angular spacing of holes (+ or -)
Number of holes)
This G code is similar to G70 except that it is not limited at one complete circle. G71 belongs to Group
zero and thus is non-modal. For a G71 to work correctly, a canned cycle should be active so that at each of
the positions, some type of drill or tap cycle is performed.
G72 Bolt Holes Along An Angle
This G code drills L holes in a straight line at the specified angle. It operates similarly to G70 and G71. G72
belongs to Group zero and thus is non-modal. For a G72 to work correctly, a canned cycle should be active
so that at each of the positions, some type of drill or tap cycle is performed.
Example of G70 Bolt Hole Circle program used in conjunction with G83 Peck Drill Cycle.
%
O100
T1 M6
G0 G90 G54 X0 Y0 S1000 M3
G43 H1 Z1.0 M8
G83 Z-2.0 R.1 Q.2 F1.5 L0
G70 I1.0 J0 L8
G00 G80 Z1.0 M9
G53 Z0
G53 Y0
M30
%
Page 72
Page 73
Four Bolt Hole Circle Exercise: Drill 1/8 holes deep in .5 thick plate. Spot drill deep to leave .012
chamfer on 1/8 holes.
T1 1/4 90 DEG SPOT DRILL 80 FT/MIN .003 IN/REV
T2 1/8 CONVENTIONAL DRILL 80 FT/MIN ., .003 IN/REV
O03901 (1 BHC)
N1 (1/2 DIAM SPOT DRILL)
G00 G17 G40 G49 G80 G90 G98
G00 G53 Z0
T1 M06 (1/4 90 DEG SPOT DRILL)
G00 G90 G54 X______ Y______ M03 S_____
G43 H01 Z1. M08
G___ Z-______ R____ F____ L___
G___ I____ J____ L__
X____ Y____ L__
G___ I___ J__ L___
X____ Y____ L___
G___ I____ J__ L__
X____ Y____ L__
G___ I____ J___ L__
G00 G____ Z1. M09
G00 G53 Z0
M01
Page 74
Page 75
Page 76
Program with a 1/4 Diameter Drill, 118 at 210 SFM with feed of .005 in/rev. (Use the HAAS calculator to
get the spindle speed and feed.) Define A rapid plane .050 up from the bottom of circular pocket for Bolt
Hole Circle and Bolt Hole Arc. Rapid plane for Bolt Holes at an Angle changes back to .1 above Z zero top
of part.
NOTE: If an L0 is in the canned cycle line, the cycle will not execute that command until the
control reads the next X and/or Y location.
O0010 (put this in after tool #2, but right before the M30 on program O0010)
T03 M06 (T3 1/4 Diameter Carbide Stub Drill)
G____ G____ G____ X____ Y____ S____ M____ (XY position to center of bolt circle)
G____ H____ Z____ M____
G____ G____ Z____ R____ F____ (drilling canned cycle with initial point return)
G____ I____ J____ L____ (Bolt Hole Circle Command)
X____ Y____ L____ (XY position center of bolt hole arc, but do not drill a hole here)
G____ I____ J____ K ____L ____
G____ X____ Y____ I____ J____ L____ R____ Z____ (Bolt hole at an angle and change the R plane)
G____ G____ Z____ M____
G____ G____ Y____ Z____
M____
Page 77
Additional G Codes
G04 Dwell
P code The dwell time in seconds or milliseconds.
G04 is used to cause a delay or dwell in the program. The block containing G04 will delay for the time
specified in the P code. When programmed on a line following some motion, such as G00, G01, G02 and
G03, all motion will be stopped for the amount of time specified in the P command in seconds. If the P
has no fraction part, the delay is in milliseconds (0.001 seconds); otherwise, the delay is in seconds.
The slide motion is stopped, but the spindle will continue to rotate at the requested RPM and the coolant
will stay on.
G04 P____
Minimum value
Maximum value
P.001 of a second
P1000. Seconds
Page 78
O10000;
G0 G90 G53 G49 Z0;
T1 M6 (1/2 E-Mill D1=.250);
G0 G90 G54 X.750 Y-.750 M3 S3500;
G43 H1 Z1.0 M8;
Z.1;
G1 Z-.375 F5.;
G41 X1.25 D1 F20.;
G3 I-.500 J0;
G1 G40 X.750 Y-.750;
G0 Z1.0 M9;
G0 G90 G53 G49 Z0 M5;
M30;
%
Page 79
Thread Milling
Thread milling uses a standard G02 or G03 move to create the circular move in X-Y, then adds a Z move on
the same block to create the thread pitch. This generates one turn of the thread; the multiple teeth of the
cutter generate the rest.
Typical line of code: N100 G02 I-1.0 Z-.05 F5. (this will generate an 1-inch radius for a 20-pitch thread)
Thread Milling notes: Internal holes smaller than 3/8 inch may not be possible or practical. Always climb
cut the cutter. Use a G03 to cut I.D. threads or a G02 to cut O.D. threads. An I.D. right hand thread will
move up in the Z-axis by the amount of one thread pitch. An O.D.
right hand thread will move down in the Z-axis by the amount of one thread pitch. PITCH = 1/Threads per
inch (Example - 1.0 divided by 8 TPI = .125)
Thread Milling Example:
O02300 (Thread milling 1.5 x 8 TPI)
T1 M06 (0.5 DIA 2FLT. THREAD MILL)
G00 G90 G54 X0. Y0. S1910 M03
(X0. Y0. is at the center of the hole)
G43 H01 Z0.1 M08
(Z0. is at the top of the part - using .5 thick material)
G00 Z-0.6
N1 G01 G41 D01 X0.125 F30.
(Turn on Cutter Comp)
N2 G03 X0.75 Y0. R0.3125 F11.5
(Arc on to the I.D. of bored hole)
N3 G03 I-0.75 Z-0.475
(One full revolution with Z moving up .125)
N4 G03 X0.125 Y0. R0.3125 F30.
(Move away from the new threads)
N5 G01 G40 X0. Y0.
(Cancel Cutter Comp)
G00 Z0.1 M09
G28 G91 Y0. Z0.
M30
This program will I.D. thread mill a 1.5 x 8 TPI hole using a .750 diameter x 1.0 thread hob.
To start, take the hole diameter (1.500). Subtract the cutter diameter .750 and
Then divide by 2. (1.500 - .75) / 2 = .375
The result (.375) is the distance the cutter starts from the I.D. of the part. After the initial positioning, the
next step of the program is to turn on cutter compensation and move to the I.D. of the circle. The next
step is to program a complete circle (G02 or G03) with a Z-axis command of the amount of one full pitch of
the thread (this is called helical interpolation)
The last step is to move away from the I.D. of the circle and turn off cutter compensation
Cutter compensation cannot be turned off or on during an arc movement. A linear move must be made,
either in the X or Y axis to move the tool to and from the diameter to cut. This move will be the maximum
compensation amount that can be adjusted
Page 80
G12, G13
D*
I
K
L
Q
F
Z
Group 00
*In order to get the exact programmed circle diameter, the control uses the selected D code tool size. If
this compensation is not desired, program D0.
This G12 Code implies the use of G42 and will mill clockwise.
Page 81
The tool must be positioned at the center of the circular pocket, either in a previous block or in this
command using X and Y position. The cut is performed entirely with circular motions of varying radius.
G12 belongs to Group zero and thus is non-modal. If G91 (incremental) is specified and an L count is
included, the Z increment is repeated L times at the F feed rate command. If no K is specified, the center
roughing passes of this command are removed completely and only one finish pass of the circular pocket
is performed.
G13
This G code implies the use of G41 and is otherwise the same as G12. G13 belongs to Group 00 and thus is
non-modal.
EXAMPLE:
02345
T1 M06
G90 G54 G00 X1.5 Y1.5
S3600 M03
G43 H01 Z.1 M08
G13 Z-.75 I.5 D01 F15.
G00 Z1.0 M09
G28 G91 Y0 Z0
M30
EXAMPLE:
03456
(.750 entered in the radius/diameter offset column)
T3 M06
(Tool #3 is a .750 diameter end mill)
G90 G54 G00 X.5 Y1.5 (XY position of center on circular pocket)
S3600 M03
G43 H01 Z.1 M08
G1 Z0 F15.
G13 G91 Z-.5 I.65 K2. Q.65 D03 L4 F15. (will complete a 4.0 diameter hole in four passes)
G00 Z1.0 M09
G28 G91 Y0 Z0
M30
The last program uses G91 and an L count of four. This cycle is multiplied by the L command and will
execute a total of four times at the Z depth increment of .500 to a total depth of 2.0 inches.
The G91 and L count can also be used in G12 and G13 I only line.
The figure below shows the tool path during the G12 and G13 cycles. One uses I only and the other uses I,
K, and Q.
Page 82
Example of multiple pass milling using I, K, and Q variables. The code is also turned into incremental
positioning with G91 and an L added. So the code is repeated 3 times stepping down Z-.5 each pass.
Milling a 3.0 diameter 1.5 deep pocket using a 0.5 end mill.
O0010 ;
T1 M06 ;
G90 G54 G00 X1.0 Y1.0 ;
S1500 M03 ;
G43 Z0.1 H1 M08;
G1 Z0 F30.
G13 G91 Z-0.5 I0.3 K1.5 Q0.3 D01 F15. L3;
G90 ;
G00 Z0.1 M09 ;
G28 G91 Y0 Z0 ;
M30 ;
Note the motion of the cutter is counter clockwise using G13 instead of G12. The radius of the first pass is
determined by I.3. First the end mill plunges in creating hole, then the first cut creates a .6 diameter
pocket with I .3. The second cut adds Q.3 to the I.3 to equal a .6 radius cut out to a 1.2 diameter.
Additional cuts are added with the Q.3 step over until the final K radius or finish pass is completed. Then
the whole process is repeated two more times stepping down incrementally the Z-.5. The final pocket
depth equals 3 x .5 to give 1.5. The above illustrations just show the initial step of three.
Note the end mill is positioned at the center of the pocket and fed down to Z0 the top face of the part.
The above illustrations and some text taken from Haas Microsoft PowerPoint titled Unique G-Codes.
Page 83
CPM1
Circular Pocket Mill CPM 1 to a depth of .250 and spiral out to size using I, K and Q. Pocket mill another
command to run on CPM 1 using I only as a finish pass.
CPM2
Circular Pocket Mill CPM 2 a 2.0 Diameter x .250 depth pocket and incremental stepping down .05 depth
using an L count and a G91 incremental command.
Program with a Diameter 2 flute E.M. at 190 SFM with .0065 in/rev per flute. (Use the HAAS calculator
to get the spindle speed and feed.)
(Put this program in after tool #1, but right before the T3 on program O0010)
Productivity Inc - Haas CNC Mill Programming Manual
Page 84
T____ M____
G____ G____
G____ H____
G____ I_____
G____ I_____
G____ Z____
X____ Y____
G01 Z0 F20.
G____ G____
Page 85
Page 86
Page 87
Page 88
This G code provides for general purpose pocket milling. The shape of the pocket to be cut must be
defined by a series of motions within a subroutine. A series of motions in either the X or Y-axis will be
used to cut out the specified shape followed by a finishing pass to clean up the outer edge - either I or J
must be specified. If I is used, the pocket is cut from a series of strokes in the X-axis. If J is used, the
pocket is cut from a series of strokes in the Y-axis. I and J must be positive numbers.
Multiple passes over the area can be selected to control the depth of the cut. At least one pass is made
over the pocket. Multiple passes are made after feeding down by Q amount until the Z depth is reached.
Q must be positive. If an L count is specified, the entire block is repeated and an incremental X or Y (G91)
will reposition the pocket.
The subroutine must define a closed area by a series of G01, G02, or G03 motions in X and Y and must end
with an M99. G codes G90 and G91 can also be used in the subroutine to select absolute or incremental.
Any codes other than G, I, J, R, X, or Y are ignored in the subroutine. This subroutine must consist of less
than 20 strokes.
Pocket milling should begin from a clearance hole, which has been previously drilled to the Z depth in
order to clear the tool on entry to the pocket. The G150 block must specify this hole location with X and Y.
The first motion in the subroutine should move from this clearance hole to the starting point of the block
shape. The final motion in the subroutine should return to the same point as the starting motion of the
subroutine, i.e., the example on the following page. The start point of the G150 line is X3.25 Y4.5 and the
first move of the sub is Y7.0. Therefore, the end of the sub must return to X3.25 Y7.0.
If a K is specified, the finishing pass is taken along the outside edge, but is done at the full pocket depth,
and the previous cuts will cut inside the programmed pocket size by K.
Page 89
Page 90
Page 91
ABSOLUTE SUBPROGRAM:
00500
G01 Y2.0
X-2.0
Y-2.0
X2.0
Y2.0
X0
M99
INCREMENTAL SUBPROGRAM:
00500
G01 G91 Y2.0
X-2.0
Y-4.0
X4. 0
Y4. 0
X-2.0
G90
M99
SQUARE ISLAND:
01000
T1 M06
(Tool is a .500 diameter end mill)
G00 G90 G54 S2500 M03
G43 H01 Z.1 M08
G01 Z0 Fl 0.
G150 X1.0 Y1.0 Z-.5 F15. R.1 Q.25 I.4 K.01 P500 D01 G41
G00 Z1.0 M09
G40 G28 G91 Y0 Z0
M30
Productivity Inc - Haas CNC Mill Programming Manual
Page 92
00500
G01 X0 Y0
X6.0
Y6.0
X0
Y3.0
X2.0
Y4.0
X4.0
Y2.0
X2.0
Y3.0
X0
Y0
M99
ROUND ISLAND:
01000
T1 M06
(Tool is a .500 diameter end mill)
G00 G90 G54 S2500 M03
G43 H01 Z.1 M08
G01 Z0 Fl 0.
G150 X1.0 Y1.0 Z-.5 F15. R.1 Q.25 I.4 K-01 P500 D01 G41
G00 Z1.0 M09
G40 G28 G91 Y0 Z0
M30
Page 93
O0500
G01 X0 Y0
X6.0
Y6. 0
X0
Y3.0
X2.0
G02 I1.0
G01 X 0
Y0
M99.
Page 94
G150 EXERCISE:
Mill pocket using a 4 flute End Mill, to a final pocket depth of .5 inch. Step down in .25 increments.
Run end mill at surface feed of 120 ft/min with a chip load of .002in/rev. Set middle of part as the origin
for programming.
04500 (G150 pocket exercise)
T1 M06 (1/2 Drill tool #1 cuts entry for end mill)
G90 G54 G00 X0 Y0 (starting hole position)
S2000 M03
G43 H01 Z1.0 M08
G83 Z-.50 R.1 Q.25 F10.
G80 G00 Z1.0 M09
G28 G91 Z0 M05
T2 M06
G00 G90 G54 X0 Y0 S____ M03
G43 H2 Z.1 M08
G01 Z0 F10.
G150 X ____ Y____ Z____ F___ R___ Q___ I____ K___ P4600 D___ G41 OR G42
G00 Z1.0 M09
G28 G40 G91 Y0 Z0
M30
04600
G01 X____ Y____
X____
Y____
G ___X____ Y____ R____
G___ X_____
G___ X_____Y____ R____
G1 Y____
X_____
M99
Page 95
Engraving (G47)
G47 ENGRAVING
E
F
I
J
P
R
X
Y
Z
=
=
=
=
=
=
=
=
=
=
GROUP 00
Plunge rate (units/min)
Engraving feed rate (units/min)
Angle of rotation (-360. to +360.), default is 0.
Scaling factor in inches (minimum = 0.001 inches), default is 1.0 inch
l for Sequential Serial Number Engraving
0 for Literal String Engraving
Return plane
X start of engraving
Y start of engraving
Depth of cut
The text to engrave should be in the form of a comment on the same line as G47, with either a P1 or P0
before it. P1 selects Sequential Serial Number Engraving and P0 selects Literal String Engraving.
P1
(####)
If the number in macro variable #599 has more characters than specified in the format string, only the
quantity specified will be printed. For example, if #599 is set to"12345" and only four places are specified
in the format string, only "2345" will be engraved.
Page 96
However, programs downloaded through the serial port or the floppy drive can take advantage of
characters not available on the mill keypad. For Literal String Engraving, the text should be in the form of
a comment on the same line as the P0 statement.
For example:
will produce:
Page 97
EXAMPLE
This example will create the engraving opposite.
O05555 (TEXT ENGRAVING)
T7M06
G00 G90 G98 G54 X2.0 Y2.0
M03 S3000
G43 H07 Z0.03 M08
G47 P0 X2.0 Y2.0 I45.J.5 R.05 Z-.005 F15.0 E10.0 (TEXT TO ENGRAVE)
G00G80Z0.03M09
M05
G28G91Z0
G00G90G54X0Y0
M30
In this example:
G47 P0
X2.0 Y2.0
I45.
J.5
R.05
Z-.005
F15.0
E10.0
Page 98
(TEXT ENGRAVING)
T4 M06
G00 G90 G98 G54 X____ Y____
S_____ M03
G43 H04 Z0.03 M08
G47 P__ X____ Y____ I___ J_____ R____ Z_____ F____ E_____ (______)
G00 G80 Z0.03 M09
M05
G28 G91 Z0
G00 G90 G54 X0 Y0
M30
Page 99
Page 100
Subroutines (Subprograms)
Subprograms are a very important part of CNC programming, however, they can make programming
become more complicated. This unit will give a brief introduction to subprograms and some of their basic
applications.
Objectives:
Upon completion of this unit, the student will:
1)
2)
3)
Know the differences between M97 (local) and M98 (separate) subprogram options.
4)
Be able to integrate a subprogram into a standard program to achieve the desired results.
5)
Page 101
Subroutines
A subprogram is a separate program called up by another program. The use of subprograms can
significantly reduce the amount of programming on some parts. Subroutines allow the CNC programmer
to define a series of commands that might be repeated several times in a program and, instead of
repeating them many times, can be called up when needed.
A subroutine call is performed using an M97 or M98 and a Pnnnn. The P code command identifies the O
program number being used when executed with M98 or an N sequence number to identify the block
where a local subroutine starts when executed with M97.
Local subroutines are called with an M97. This can be easier to use than the M98 because the subroutine
is contained within the main program without the need to define a separate Onnnn program. With local
subroutines, you define an M30 for the end of your main program portion followed by a sequence
number to define the beginning of your subroutine.
This subroutine call causes the blocks in the subroutine to be executed as if they were included in the
main program. To return back to the main program, you need to end the subroutines with an M99, which
sends it back to the next line after the subroutine call in the main program.
Another important feature of a subroutine call is that the M98 block may also include an L (loop) or
repeat count. If there is an Ln with the subroutine call, it is repeated that number of times before the
main program continues with the next block.
The most common use of subroutines is in the definition of a series of holes, which may need to be center
drilled, peck drilled, taped, and/or chamfered. If a subroutine is defined that consists only of the X-Y
position of the holes, the main program can define the canned cycles and the hole locations can be called
up in the subroutine to do each of the tool operations. Thus, the X-Y positions can be entered only once
and used several times for each tool.
O0100 (main program using subroutines);
T01 M06 (center drill);
G90 G54 G00 X0.5 Y0.5;
S2000 M03;
G43 Z0.5 H01;
G81 Z-0.3 R0.1 F15. (define canned cycle);
M98 P0200 (call subroutine O200);
T02 M06 (peck drill);
G90 G54 G00 X0. 5Y 0.5;
S1500 M03;
G43 Z0.5 H02;
G83 Z-1. R0.1 Q.100 F10. (define canned cycle);
M98 P0200 (call subroutine O200);
T03 M06 (1/4 20 tap);
G90 G54 G00 X.5 Y.5;
S400 (G84 will turn spindle on, no M03 is needed);
G43 Z1. H03;
G84 Z-1. R.1 F10. (define canned cycle);
M98 P0200 (call subroutine O200);
Productivity Inc - Haas CNC Mill Programming Manual
Page 102
Page 103
Exercises
Canned Cycle Exercise #1
Page 104
Page 105
Page 106
Page 107
FINAL EXERCISES
Tool #1 - 2.00 diameter 4 flute end mill finish diamond shape contour 1 pass at .3 depth
275 SFM - .005 inch/rev per tooth
Tool #2 1 diameter insert drill rough 1.800 circular pocket at .480 depth
250 SFM - .0075 inch/rev
Tool #3 5/8 diameter 4 flute end mill finish mill 1.800 diameter circular pocket .5 depth
220 SFM - .0045 inch/rev per tooth
Tool #4 diameter spot drill drill 6 holes .2 depth
200 SFM - .005 inch/rev
Tool #5 5/16 diameter drill (6) holes through
200 SFM - .005 inch/rev
Tool #6 3/8 16 tap (6) holes through
Tap at 600 RPM and your machine has rigid tapping
Tool #7- Engrave your name anywhere on the part using a1/8 inch ball end mill
Engrave at 200ft/min - .001 in/rev
Productivity Inc - Haas CNC Mill Programming Manual
Page 108
CLASS EXERCISE
Tool #1 2.00 diameter 4 flute end mill - climb cut a finish pass around diamond shape contour - 1 pass at
.3 depth using cutter compensation.
275 SFM - .005 inch/rev per tooth
01234
T____ M____ (tool #1 2.00 diameter end mill)
G____ G____ G____ X____ Y____
M____ S____
G____ H____ Z____ M____
G____ Z____ F____
G____ Y____ D____ F____
X____
X____ Y____
X____ Y____
X____ Y____
X____ Y____
G____ Y____
G____ Z____ M____
G____ G____ Z____
M____
Be sure to position cutter at least half the cutter diameter off of the part surface before canceling cutter
comp.
Page 109
CLASS EXERCISE
Tool #2 1 3/4 diameter insert drill rough 1.800 circular pocket at .480 depth
Speed 250 SFM. Feed .0075 inch/rev
T____ M____ (tool #2 1 3/4 diameter insert drill)
G____ G____ G____ X____ Y____
M____S____
G____ Z____ H____ M____
G____ Z____ R____ F____
G____ G____ Z____ M____
G____ G____ Z____
M____
Page 110
CLASS EXERCISE
Tool #3 5/8 diameter 4 flute end mill mill a 1.800 diameter circular pocket .5 depth
220 SFM - .0045 inch/rev per tooth
T____ M____ (tool #3 5/8 diameter 4 flute end mill)
G____ G____ G____ X____ Y____
M____S____
G____ Z____ H____ M____
G____ I____ K____ Q____ Z____ D____ F____
G____ Z____ M____
G____ G____ Z____
M____
Page 111
CLASS EXERCISE
Page 112
(Subprogram)
O1000 (subprogram)
X-.___ Y-__.__
G__ __ X-___ Y-.___
Y.____
X__.__
G__ __ Y-.____
X.____ Y-__.__
G__ G__ Z__M__
M__ __
Page 113