PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ......

117
PROGRAMMING WORKBOOK HAAS AUTOMATION, INC. 2800 Sturgis Rd. Oxnard, CA 93030 JUNE 1, 2000

Transcript of PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ......

Page 1: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

PROGRAMMING WORKBOOK

HAAS AUTOMATION, INC.2800 Sturgis Rd.

Oxnard, CA 93030

JUNE 1, 2000

Page 2: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

JUNE 2000 PROGRAMMING

CONTENTS

INTRODUCTION .................................................................................................. 1THE COORDINATE SYSTEM ............................................................................. 2MACHINE HOME ................................................................................................. 5ABSOLUTE AND INCREMENTAL POSITIONING ........................................... 5POSITIONING EXERCISE................................................................................... 7PROGRAMMING WITH CODES ......................................................................... 8PROGRAM STRUCTURE ................................................................................... 9PROGRAM FORMAT......................................................................................... 13MISCELLANEOUS FUNCTIONS (M CODES) ................................................. 16PREPARATORY FUNCTIONS (G CODES) ..................................................... 18MACHINE DEFAULTS ....................................................................................... 22LIST OF CANNED CYCLES ............................................................................. 23ALPHABETICAL ADDRESS CODES .............................................................. 24RAPID POSITION COMMANDS (G00)............................................................. 28INTERPOLATION COMMANDS (G01)............................................................. 29CIRCULAR INTERPOLATION COMMANDS (G02,G03) ................................ 30INTERPOLATION EXERCISE........................................................................... 39PROGRAM START-UP LINES .......................................................................... 40PROGRAM ENDING LINES .............................................................................. 41DWELL (G04) ..................................................................................................... 42CIRCULAR POCKET MILLING (G12, G13) ..................................................... 43CIRCULAR POCKET MILLING EXERCISE .................................................... 46CIRCULAR PLANE SELECTION (G17, G18, G19) ........................................ 47INCH / METRIC SELECTION (G20, G21) ........................................................ 51REFERENCE POINT DEFINITION AND RETURN (G28) ............................... 52CUTTER COMPENSATION (G40, G41, G42) ................................................. 53CUTTER COMPENSATION EXERCISE #1 ..................................................... 59CUTTER COMPENSATION EXERCISE #2 ..................................................... 62HELICAL MOTION ............................................................................................. 64TOOL LENGTH COMPENSATION (G43) ........................................................ 66WORK COORDINATE SELECTION (G54-59, G110-129, G52, G53, G92)... 67NON-MODAL COORDINATE SELECTION (G53) ........................................... 67ANOTHER WAY TO SEND MACHINE HOME USING G53 SELECTION ..... 68CANNED CYCLES DESCRIPTION .................................................................. 69CANCEL - CANNED CYCLE (G80) .................................................................. 70DRILL - CANNED CYCLE (G81) ...................................................................... 71SPOT DRILL - CANNED CYCLE (G82) ........................................................... 72

Page 3: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

JUNE 2000 PROGRAMMING

CONTENTS

DEEP HOLE PECK DRILLING CANNED CYCLE (G83) ................................ 73CANNED CYCLE EXERCISE #1 ...................................................................... 76TAPPING - CANNED CYCLE (G84) ................................................................. 78BORE IN - BORE OUT - CANNED CYCLE (G85) ........................................... 79BORE IN - STOP - RAPID OUT - CANNED CYCLE (G86) ............................. 80BORE IN - MANUAL RETRACT - CANNED CYCLE (G87) ........................... 81BORE IN - DWELL - MANUAL RETRACT - CANNED CYCLE (G88) ........... 82BORE IN - DWELL - BORE OUT - CANNED CYCLE (G89) .......................... 83CANNED CYCLE EXERCISE #2 ...................................................................... 84HIGH SPEED PECK DRILL - CANNED CYCLE (G73) ................................... 86REVERSE TAPPING - CANNED CYCLE (G74) .............................................. 90FINE BORING - CANNED CYCLE (G76) ......................................................... 91BACK BORE - CANNED CANNED CYCLE (G77) .......................................... 92CANNED CYCLE RETURN PLANES (G98, G99) .......................................... 93CANNED CYCLES BOLT HOLE PATTERNS (G70, G71, G72) .................... 94CANNED CYCLES BOLT HOLE PATTERN (G70) ......................................... 95CANNED CYCLES BOLT HOLE PATTERN (G71) ......................................... 96CANNED CYCLES BOLT HOLE PATTERN (G72) ......................................... 97CANNED CYCLE EXERCISE #3 ...................................................................... 98SUBROUTINES (M97, M98, M99) .................................................................. 100GENERAL PURPOSE POCKET MILLING (G150) ....................................... 103FINAL EXERCISE ............................................................................................ 108

Page 4: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

1

JUNE 2000 PROGRAMMING

INTRODUCTION

This manual provides basic programming principles necessary to begin program-ming the HAAS C.N.C. Milling Machine.

In a �CNC� (Computerized Numerical Control) machine, the tool is controlled by acomputer and is programmed with a machine code system that enables it to beoperated with minimal supervision and with a great deal of repeatability.

The same principles used in operating a manual machine are used in programminga CNC machine. The main difference is that instead of cranking handles to positiona slide to a certain point, the dimension is stored in the memory of the machinecontrol once. The control will then move the machine to these positions each timethe program is run.

In order to operate and program a CNC controlled machine, a basic understandingof machining practices and a working knowledge of math is necessary. It is alsoimportant 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 workbook can be used for both operator�s and programmer�s. It is intended togive a basic understanding of CNC programming and it�s applications. It is notintended as an in-depth study of all ranges of machine use, but as an overview ofcommon and potential situations facing CNC programmers. Much more trainingand information is necessary before attempting to program on the machine.

This programming manual is meant as a supplementary teaching aid to users of theHAAS Mill. The information in this workbook may apply in whole or in part to theoperation of other CNC machines. Its use is intended only as an aid in the operationof the HAAS Milling Machine. For a complete explanation and an in-depth descrip-tion, refer to the Programming and Operation Manual that is supplied with yourHAAS Lathe.

Page 5: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

2

JUNE 2000PROGRAMMING

THE COORDINATE SYSTEM

The first diagram we are concerned with is called a NUMBER LINE. This numberline has a zero reference point that is calledan ABSOLUTE ZERO and may be placed atany point along the number line.

Horizontal number line

The number line also has numbered increments on either side of absolutezero. Moving away from zero to the right are positive increments. Movingaway from zero to the left are negative increments. The �+�, or positiveincrements, are understood, therefore no sign is needed. We use positiveand negative signs along with increment value's to indicate its relationshipto zero on the line. If we choose to move to the third increment on the minus(-) side of zero, we would call for -3. If we choose the second increment inthe plus range, we would call for 2. Our concern is the distance and thedirection from zero.

Remember that zero may be placed at any point along the line, and thatonce placed, one side of zero has negative increments and the other sidehas positive increments.

The machine illustration shows threedirections of travel available on a ver-tical machine center. To carry the num-ber line idea a little further, imaginesuch a line placed along each axis ofthe machine. It shows the three direc-tions to position the coordinatesaround a part origin, which is wherethese number lines intersect on a ver-tical machining center with the X, Y,and Z axis lines.

The first number line is easy to con-ceive as belonging to the left-to-right,or �X�, axis of the machine. If weplace a similar number line along thefront-to-back, or �Y� axis, the incre-ments (not the table) toward the op-erator, from Y zero, are the negativeincrements. The increments on theother side of zero away from the op-erator are positive increments.

Vertical number line

Page 6: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

3

JUNE 2000 PROGRAMMING

v

The third axis of travel on our machine is the up-and-down, or �Z� axis. When weplace a number line on the Z travel, the positive increments are up above zero, andthe negative values are down below zero. The increments of each number line onHAAS machining centers equals .0001 inches. Also, while a line theoreticallytravels infinitely in either direction once established, the three lines placed alongthe X, Y, and Z axes of the machine do not have unlimited accessibility. That is tosay, we are limited by the range of travel on the model of machining center.

MACHINE X-axis travel Y-axis travel Z-axis travel

VF-E / VF-0 / VF1 20" 16" 20"

VF-EXT / VF-OE 30" 16" 20"

VF2 30" 16" 20"

VF3 40" 20" 25"

VF4 50" 20" 25"

VF5 50" 25" 25"

VF6 64" 32" 30"

VF7 84" 32" 30"

VF8 64" 40" 30"

VF9 84" 40" 30"

VF10 120" 32" 30"

VF11 120" 40" 30"

VR11 120" 40" 30"

HS-1/1R/1RP 24" 20" 22"

HS-2RP 38" 35" 30"

Remember, when we are moving the machine, we are concerned with positioningthe center of the spindle in relation to X,Y and Z zero. Although the machine tableis the moving part, we have to keep in mind our coordinates are based off ourtheoretical spindle movement.

Keep in mind that the part zero position may be defined at any point along each ofthe three axes, and will usually be different for each setup of the machine.

It is noteworthy to mention here that the Z-axis is set with the machine zero positionin the upward position, or the tool change position. This will place most all Z movesin a negative range of travel.

Page 7: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

4

JUNE 2000PROGRAMMING

Fig. 1-4 view shows the X,Y work zero grid from above. The work part zero for theZ-axis is usually set at the top of the part surface, and this will be entered in the toollength offset as a negative value for each tool. The range of Z-axis travel on theHAAS VF-1, for example, is 20 inches total; four of these inches are above toolchange position and is listed as a positive tool length offset, and 16 inches arebelow tool change position and listed as a negative. The diagram shows a top viewof the grid as it would appear on the machine tool. This view shows the X and Y axesas the operator faces a vertical machine table. Note that at the intersection of the

two lines, a common zero point is established. Thefour areas on each side and above and below thelines are called �QUADRANTS� and make up thebasis for what is known as rectangular coordinateprogramming.

QUADRANT 1 IS ON THE TOP RIGHT = X+ Y+QUADRANT 2 IS ON THE TOP LEFT = X- Y+QUADRANT 3 IS ON THE BOTTOM LEFT = X- Y-QUADRANT 4 IS ON THE BOTTOM RIGHT = X+ Y-

Whenever we set a zero point somewhere on the X-axis and, a zero point somewhere on the Y-axis, wehave automatically set a work zero point and anintersection of the two number lines. This intersec-tion where the two zeros come together will auto-matically have the four quadrants to its sides, above,and below it. How much of a quadrant we will be

able to access is determined by where we place the zero point within the travel ofthe machine axes. For example, for a VF-1, if we set zero exactly in the middle ofthe travel of X and Y (table center), we have created four quadrants that are 10inches by 8 inches in size.

Page 8: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

5

JUNE 2000 PROGRAMMING

MACHINE HOME

When a zero return (ZERO RET) is performed at machine start up, all three axes aremoved to extreme positive locations until limit switches are reached. When thiscondition is satisfied, the only way to move any of the three axes is in the negative

direction (except for a positive four inches in Z-axis). Thisis because this position is defined as your MACHINEHOME for each of the three axes automatically when themachine was sent home with the POWER-UP/RESTARTkey. In effect, now the positive quadrants cannot be reachedfrom machine home position in X and Y axes, and all themoves will be found to be in the X-, Y- quadrant. It is onlyby setting a new part zero somewhere within the travel ofeach axes that other quadrants are able to be reached.Sometimes it is useful in the machining of a part to utilizemore than one of these X,Y quadrants. An example of thisis a round part that has it�s datum lines running through thecenter. The setup of such a part may need machining to beperformed in all four quadrants of a part. This is why you

would want to make use of all four quadrants of the X and Y axes on a millingmachine. As you gain more experience in machine tool programming and of setuptechniques, you'll have a better understanding of how to position your machine tooland how to define a part zero origin and how to position a tool around that origin .

ABSOLUTE AND INCREMENTAL POSITIONING

Up to this point, we have dealt with a system of positioning the tool that is known asabsolute programming. In absolute, all coordinate positions are given with regardto their relationship to a fixed zero, origin point, that is referred to as part zero. Thisis the most common type of positioning.

Another type of positioning is called incremental positioning. Incremental position-ing concerns itself with distance and direction from the last position. A newcoordinate is entered in terms of its relationship to the previous position, and notfrom a fixed zero or origin. In other words, after a block of information has beenexecuted, the position that the tool is now at is the new zero point for the next moveto be made.

All four quadrants will haveto be accessed to position

around this part XY zero point.

Page 9: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

6

JUNE 2000PROGRAMMING

An example of the use of the incremental system is below. Note that to move fromX 4.25 to X 2.025 on the scale, an incremental move of X -2.225 is made, eventhough the move still places the tool on the plus side of the scale. Therefore themove was determined from the last point, with no regard for the zero position. The+ and - signs are used in terms of direction, and not in regard to the position of zero.

An example of an incremental move.

Keep in mind that when positioning in absolute, we are concerned with distanceand direction from a fixed zero reference point, and when positioning in incrementalwe are concerned with distance and direction from the last position.

ABSOLUTE / INCREMENTAL SELECTION

G90 ABSOLUTE POSITION COMMANDThis code is modal and changes the way axis motion commands are interpreted.G90 makes all subsequent commands absolute positions within the selected usercoordinate system. Each axis that is moved will be placed at the position coded inthe command block.

G91 INCREMENTAL POSITION COMMANDThis code is modal and changes the way axis motion commands are interpreted.G91 makes all subsequent commands incremental. Each axis that is moved will bemoved by the amount coded in the command block.

Page 10: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

7

JUNE 2000 PROGRAMMING

POSITIONING EXERCISE

What is the value in X and Y for each hole in absolute G90 positioning when eachmove is defined from a single fixed part zero point of an X0 Y0 origin point.

PT1 = X______ Y______PT2 = X______ Y______PT3 = X______ Y______PT4 = X______ Y______PT5 = X______ Y______PT6 = X______ Y______PT7 = X______ Y______PT8 = X______ Y______

What is the value for each hole in INCREMENTAL G91 positioning when eachmove is defined from the previous position and the zero point shifts with the newposition.

From PT8 to PT9 = X______ Y______From PT9 to PT10 = X______ Y______From PT10 to PT11 = X______ Y______From PT11 to PT12 = X______ Y______From PT12 to PT13 = X______ Y______From PT13 to PT14 = X______ Y______

Page 11: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

8

JUNE 2000PROGRAMMING

PROGRAMMING WITH CODES

The definition of a part program for any CNC consists of movements of the tool, andspeed changes to the spindle RPM. It also contains auxiliary command functionssuch as tool changes, coolant on or off commands, or external M code commands.

Tool movements consist of rapid positioning commands, straight line moves ormovement along an arc of the tool at a controlled feedrate.

This milling machine has three (3) linear axes defined as X axis, Y axis, and Z axis.The X and Y axis will move the machine table below and around the spindlescenterline, while the Z axis moves the tool spindle down toward or up and away fromthe machine table. The machine zero position is where the spindle is pointing downat the upper right corner, with the machine table all the way to the left in X axis andall the way toward you in the Y axis and Z axis is up at the tool change position.Motion in the X axis will move the machine table to the left with negative values andto the right with positive values. Motion in the Z axis will move the tool toward themachine table with negative values and away from the machine table with positivevalues.

A program is written as a set of instructions given in the order they are to beperformed. The instructions, if given in English, might look like this:

LINE #1 = SELECT CUTTING TOOLLINE #2 = RAPID TO STARTING POSITION OF PART, TURN COOLANT ONLINE #3 = TURN SPINDLE ON AND SELECT THE RPMLINE #4 = CHOOSE THE PROPER FEED RATE AND MAKE THE CUT(S)LINE #5 = TURN OFF THE SPINDLE AND THE COOLANTLINE #6 = RETURN TOOL TO HOLDING POSITION AND SELECT NEXT TOOL

and so on. But our machine control understands only these messages when givenin machine code, or G and M code programming.

Page 12: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

9

JUNE 2000 PROGRAMMING

PROGRAM STRUCTURE

A CNC part program consists of one or more blocks of commands. When viewingthe program, a block is the same as a line of text. Blocks shown on the CRT arealways terminated by the � ; � symbol which is called an EOB. Blocks are made upof alphabetical address codes. Address codes are always an alphabetical charac-ter followed by a numeric value. For instance, the specification of the position tomove the X-axis would be a number preceded by the X symbol.

Programs must begin and end with a % sign. The % signs are automatically enteredin for you, if you enter the program in on a HAAS control.

A program may also contain a � / � symbol. The � / � symbol, sometimes called aslash, is used to define an optional block. If a block contains this symbol, anyinformation that follows the slash in a program block, will be ignored when theBLOCK DELETE button is selected when running a program.

There is no positional requirement for the address codes. They may be placed inany order within the block. The following page is a sample program as it wouldappear on the control screen. The words following the �:� are not part of the actualprogram but are put there as further explanation.

This program will drill four holes and mill a two-inch hole in a four-inch square platewith X and Y zero at the center. The program with comment statements wouldappear like this.

Page 13: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

10

JUNE 2000PROGRAMMING

% :PROGRAM MUST BEGIN AND END WITH %O01010 :PROGRAM NUMBER, LETTER "O" WITH FOUR DIGIT NUMBER

(MILL PART PROGRAM EXAMPLE) :(COMMENTS IN PARENTHESIS ARE IGNORED BY CONTROL)

N1 (DRILL 4 PLACES) :(COMMENTS IN PARENTHESIS ARE IGNORED BY CONTROL)

T1 M06 (½ IN. DIA. STUB DRILL) :TOOL CHANGE TO TOOL #1, (NOTES TO OPERATOR)G90 G54 G00 X-1.5 Y1.5 S1400 M03 :ABS POSIT, WORK OFFSET#, RAPID X Y, SPINDLE ON CW

G43 H01 Z1. M08 :TOOL LENGTH COMP #1, Z POSITION, COOLANT ONG73 G99 Z-0.625 Q0.2R0.1 F5. :HIGH SPEED PECK DRILLING, DRILL Z-.625 DEEP, .2 PECK

Y-1.5 :DRILL ANOTHER HOLE RAPID PLANE IS AT R.1/ X1.5 :DRILL THIRD HOLE WITH AN OPTIONAL BLOCK DELETE

/ Y1.5 :DRILL FOURTH HOLE WITH AN OPTIONAL BLOCK DELETE

G80 G00 Z1. M09 :CANCEL CANNED CYCLE, RAPID Z1. COOLANT OFFG28 G91 Z0 M05 :RETURN Z TO MACHINE ZERO, SPINDLE OFF

N2 (COUNTERSINK 4 PLACES) :(COMMENTS IN PARENTHESIS ARE IGNORED BY CONTROL)

T2 M06 (5/8 DIA. 90 DEG. C'SINK) :TOOL CHANGE TO TOOL #2, (NOTES TO OPERATOR)

G90 G54 G00 X-1.5 Y1.5 S900 M03 :ABS POSIT, WORK OFFSET#, RAPID TO POSIT, SPINDLE ON CW

G43 H02 Z1. M08 :TOOL LENGTH COMP #2, Z POSITION, COOLANT ON

G82 G99 Z-0.27 P0.5 R0.1 F12. :SPOT DRILL CYCLE TO Z-.27 DEEP, DWELL .5 SECOND

Y-1.5 :SECOND HOLE , RAPID PLANE IS AT R.1

/ X1.5 :THIRD HOLE WITH AN OPTIONAL BLOCK DELETE

/ Y1.5 :FOURTH HOLE WITH AN OPTIONAL BLOCK DELETE

G80 G00 Z1. M09 :CANCEL CANNED CYCLE, RAPID Z1., COOLANT OFF

G28 G91 Z0 M05 :RETURN Z TO MACHINE ZERO, SPINDLE OFF

N3 (SET D3 DIA. OFFSET VALUE TO .500) :(COMMENTS IN PARENTHESIS ARE IGNORED BY CONTROL)

T3 M06 (½ DIA. END MILL) :TOOL CHANGE TO TOOL #3 (NOTES TO OPERATOR)

G90 G54 G00 X-2.3 Y2.3 S1100 M03 :ABS POSIT, WORK OFFSET#, RAPID TO POSIT, SPINDLE ON CW

G43 H03 Z0.1 M08 :TOOL LENGTH COMP #3, Z POSITION, COOLANT ON

G01 Z-0.625 F30. :FEED TO DEPTH

G41 Y2. D03 F11. :COMPENSATE CUTTER LEFT OF LINE

X2.0 :CUT A 2.0 IN. SQUARE CW WITH TOOL DIA. COMP D03

Y-2.0X-2.0Y2.25G40 X-2.3 Y2.3 :G40 CANCELS COMP WHILE POSITIONING AWAY FROM PART

G00 Z1. M09 :RAPID Z1., COOLANT OFF

G28 G91 Y0 Z0 M05 :RETURN Y AND Z TO MACHINE ZERO

T1 M06 :TOOL CHANGE BACK TO TOOL #1

M30 :PROGRAM STOP AND REWIND TO BEGINNING

% :PROGRAM MUST BEGIN AND END WITH %

To change tools, all that is needed is an M06 even without a G28 in the previousline. A G28 can be specified to send all axes to machine home, or it can be definedto send a specific axis home with G28 G91 Z0 and/or Y0 and/or X0 to send just theseaxis specified to home position.

Page 14: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

11

JUNE 2000 PROGRAMMING

OFTEN USED PREPARATORY (G) CODES:

G00 Rapid traverse motion; Used for positioning of non-cutting moves.NOTE: Machine rapids at 710 inches per minute (IPM).

G01 Linear interpolation motion; Used for actual machining and metalremoval. Program with a feedrate in inches (or mm) per minute.Maximum feedrate of machine is 300 inches per minute.

G02 Circular Interpolation - Clockwise

G03 Circular Interpolation - Counterclockwise

G28 Machine Home (Rapid traverse)

G40 Cutter Compensation m CANCEL

G41 Cutter Compensation LEFT

G42 Cutter Compensation RIGHT

G43 Tool LENGTH Compensation+

G54 Work Coordinate #1 (Part zero)

G80 Canned Cycle Cancel

G81 Drill Canned Cycle

G82 Spot Drill Canned Cycle

G83 Peck Drill Canned Cycle

G84 Tapping Canned Cycle

G90 Absolute Programming Positioning

G91 Incremental ProgrammingPositioning

G98 Initial Point Return

G99 Reference Plane Return

Page 15: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

12

JUNE 2000PROGRAMMING

MISCELLANEOUS M CODES:

M00 The M00 code is used to stop a program. It also stops the spindle,turns off the coolant and stops interpretation lookaheadprocessing. The CYCLE START button will continue programoperation from the next block.

M01 The M01 command is identical to M00 except that it only stops ifoptional stop, OPT STOP key, is turned on from the control panel.A cycle start will continue program operation from the nest block.

M03 Starts the spindle Clockwise. Must have a spindle speed defined.

M04 Starts the spindle Counterclockwise. Must have a spindle speed defined.

M05 Stops the spindle.

M06 Tool change command along with a tool number will execute atool change for that tool. This command will automatically stop thespindle, Z-axis will automatically move up to the machine zeroposition and the selected tool will be put in spindle. The coolantpump will turn off during a tool change.

M08 Coolant ON command.

M09 Coolant OFF command.

M30 Program end and rewind to beginning of program.

M97 Local subroutine call.

M98 Subprogram call.

M99 Subprogram return, or loop.

NOTE: Only one "M" code can be used per line. The "M" code will be the lastcommand code to be performed in a line, regardless of where it's located in that line.

Page 16: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

13

JUNE 2000 PROGRAMMING

PROGRAM FORMAT

The format defines the "language of the machine tool." A description of theparticular words that a machine may accept, the order in which they must appear,the number of numeric digits associated with each word, the location of the decimalpoint, and the presence or absence of signs.

Program format, or program style is an important part of CNC machining. Eachindividual can format their programs many different ways. There are some programcommand formats that can be moved around, and some commands need to be acertain way, and there are some standard program rules that are just good to follow.The point is that a programmer needs to have an organized program format that�sconsistent and efficient so that any CNC machinist in your shop can understand it.

Some standard program rules to consider are:

Program X, Y and Z in alphabetical order on any block. The machine will read Y, Zor X in any order, but we want to be consistent. Write X first, Y second Z third.

You can put G and M codes anywhere on a line of code. But , in the beginning whenN/C programming was being developed G codes had to be at the beginning, of aprogram line, and M codes had to be at the end. And this rule, a lot of people stillfollow and is a good standard to continue.

Some CNC machines allow you to write more the one M code per line of code andsome won�t. On the HAAS, only one M code may be programmed per block and allM codes are activated or cause an action to occur after everything else on the linehas been executed. The list of M codes is on page 16.

The format defines a description of the line of code or the sequence of the particularcommands in a program that a machine may accept and execute. Along with theorder in which it must appear, the number of numeric digits associated with eachword, the location of the decimal point, and the presence or absence of signs. Theprogram format defines the "language of the machine tool."

Page 17: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

14

JUNE 2000PROGRAMMING

DEFINITIONS WITHIN THE FORMAT

1. CHARACTER : A single alphanumeric character value or the "+" and "-" sign.

2. WORD : A series of characters defining a single function such as,"X" displacement or an "F" feedrate. A letter is the first character of a word for eachof the different functions. The balance of the word is made up of a plus (+) or minus(-) sign. A plus (+) is recognized if no sign is given in a word.

3. BLOCK : Series of words defining a single instruction. An instruction mayconsist of a single linear motion, a circular motion or a canned cycle, plus additionalinformation such as a feedrate or stop command.

4. POSITIVE SIGNS : If the value following an address letter command such as A,B, C, I, J, K, R, U, V, W, X, Y, Z, is positive, the plus sign need not be programmedin. If it has a minus (-) value it must be programmed in with a minus (-).

5. LEADING ZERO'S : If the digits proceeding a significant number are zero, they neednot be programmed. The HAAS control will automatically enter in the leading zero's.EXAMPLE: G0 for G00 and M1 for M01,Trailing zeros must be programmed: M30 not M3, G70 not G7.

6. MODAL COMMANDS : Codes that are active for more than the line in which theyare issued are called MODAL commands. Rapid traverse, feedrate moves, andcanned cycles are all examples of modal commands. A NONMODAL commandwhich, once called, are effective only in the calling block, and are then immediatelyforgotten by the control.

7. PREPARATORY FUNCTIONS : "G" codes use the information contained on theline to make the machine tool do specific operations, such as :

1.) Move the tool at rapid traverse.2.) Move the tool at a feedrate along a straight line.3.) Move the tool along an arc at a feedrate in a clockwise direction.4.) Move the tool along an arc at a feedrate in a counterclockwise direction.5.) Move the tool thru a series of repetitive operations controlled by "fixed cycles" such as, spot drilling, drilling, boring, and tapping.

8. MISCELLANEOUS FUNCTIONS : "M" codes are effective or cause an action tooccur at the end of the block and only one M code is allowed in each block.

9. SEQUENCE NUMBERS : Are code N1 thru N9999 that are only used to locateand identify a block or line and its relative position within a CNC program. Aprogram can be input with or without SEQUENCE NUMBERS. The only function ofSEQUENCE NUMBERS is to locate a certain block or line within a CNC program.

Page 18: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

15

JUNE 2000 PROGRAMMING

An example of a program's first threelines might look like this :

T1 M06 ;G90 G54 G00 X0. Y0. S2500 M03;G43 H01 Z1. M08;

or another format you might choose is:

T1 M06 ;G00 G90 G54 X0. Y0.S2500 M03;G43 Z1. H01 M08;

The tool startup lines with the necessary codes for each tool are listed above. Theseformats are a good example for startup lines that are entered in for each tool.

The FIRST line or block in a program should be a tool number (T1) and tool change(M06) command.

The SECOND line or block should contain an absolute (G90) or an incremental(G91 rarely used in a startup line) command, along with a work offset part zerocommand (G54 is the default) location for X and Y axis, a rapid (G00) command, apositioning X Y coordinate location, a spindle speed command (Snnnn), and aspindle ON clockwise command (M03), or you could have the spindle speed andclockwise command defined on a seperate line.

The NEXT line or block contains a �Read tool length compensation� command(G43), a tool length offset register number (H01), a Z-axis positioning move (Z1.0),and an optional coolant ON command (M08).

Note: A tool length offset number should usually always remain numerically matchedwith the tool number. Setting 15 (the H & T code agreement) will ensure the toolnumber and the tool length offset number will match. (Example: T1 in line #1 shouldhave H01 in line #3 or an alarm will occur if Setting 15 is ON.)

Page 19: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

16

JUNE 2000PROGRAMMING

MISCELLANEOUS FUNCTION (M CODES)

All M codes are activated or cause an action to occur at the end of a block, and onlyone M code is allowed per block in a program.

M00 Stop ProgramM01 Optional Program StopM02 Program EndM03 Spindle ForwardM04 Spindle ReverseM05 Spindle StopM06 Tool ChangeM08 Coolant OnM09 Coolant OffM10 Engage 4th Axis BrakeM11 Release 4th Axis BrakeM12 Engage 5th Axis BrakeM13 Release 5th Axis BrakeM16 Tool Change (same as M06)M19 Orient Spindle

M21-M24 Optional Pulsed User M Function with FinM30 Program End and RewindM31 Chip Conveyor ForwardM32 Chip Conveyor ReverseM33 Chip Conveyor StopM34 Increment Coolant Spigot PositionM35 Decrement Coolant Spigot PositionM36 Pallet RotateM39 Rotate Tool TurretM41 Low Gear OverrideM42 High Gear Override

M51-M58 Optional User M ActivateM61-M68 Optional User M Deactivate

M75 Set Measure PointM76 Disable DisplaysM77 Enable DisplaysM78 Alarm if Skip Signal FoundM79 Alarm if Skip Signal Not Found

Page 20: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

17

JUNE 2000 PROGRAMMING

M82 Tool UnclampM86 Tool ClampM88 Through the Spindle Coolant ONM89 Through the Spindle Coolant OFFM95 Sleep ModeM96 Jump if No InputM97 Local Sub-Program CallM98 Sub Program CallM99 Sub Program Return or Loop

Page 21: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

18

JUNE 2000PROGRAMMING

PREPARATORY FUNCTIONS (G CODES)

1) G Codes come in groups. Each group will have a specific group number.

2) A G code from the same group can be replaced by another code in the samegroup. By doing this the programmer establishes modes of operation. The univer-sal rule here is, codes from the same group cannot be used more than once on thesame line.

3) There are modal G codes which, once established, remain effective untilreplaced with another code from the same group.

4) There are non-modal G codes (Group 00) which, once called, are effective onlyin that block they are in, and then, do not affect any other blocks.

The rules above govern the use of all codes for programming the Haas (and other)controls. The concept of grouping codes and rules that apply will have to beremembered if we are to effectively program the machine tool.

The following is a summary of the G codes. A � * � indicates the default within eachgroup, if there is one:

PREPARATORY FUNCTIONS (G CODES)

Code: Group: Function:G00 * 01 Rapid MotionG01 01 Linear Interpolation MotionG02 01 CW Interpolation MotionG03 01 CCW Interpolation MotionG04 00 DwellG09 00 Exact StopG10 00 Set OffsetsG12 00 CW Circular Pocket Milling (Yasnac)G13 00 CCW Circular Pocket Milling (Yasnac)G17 * 02 XY Circular Plane SelectionG18 02 ZX Circular Plane SelectionG19 02 YZ Circular Plane SelectionG20 06 Verify Inch (Setting 9 will need to be on INCH)G21 06 Verify Metric (Setting 9 will need to be on METRIC)G28 00 Return to Reference PointG29 00 Set ReturnThrough Reference Point

(M codes continued next page)

Page 22: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

19

JUNE 2000 PROGRAMMING

Code: Group: Function:G31 00 Feed Until Skip (optional)G35 00 Automatic Tool Diameter Measurement (optional)G36 00 Automatic Work Offset Measurement (optional)G37 00 Automatic Tool Offset Measurement (optional)G40 * 07 Cutter Comp CancelG41 07 2D Cutter Compensation LeftG42 07 2D Cutter Compensation RightG43 08 Tool Length Compensation +G44 08 Tool Length Compensation -G47 00 Text EngravingG49 * 08 G43/G44/G143 CancelG50 11 G51 CancelG51 11 Scaling (optional)G52 12 Select Work Coordinate System (Yasnac)G52 00 Set Local Shift Coordinate System (Fanuc)G52 00 Set Local Shift Coordinate System (HAAS)G53 00 Non-Modal Machine Coordinate SelectionG54 * 12 Select Work Coordinate System 1G55 12 Select Work Coordinate System 2G56 12 Select Work Coordinate System 3G57 12 Select Work Coordinate System 4G58 12 Select Work Coordinate System 5G59 12 Select Work Coordinate System 6G60 00 Unidirectional PositioningG61 13 Exact Stop ModalG64 * 13 G61 CancelG65 00 Macro Subroutine Call (optional)G68 16 Rotation (optional)G69 16 G68 Cancel (optional)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 CycleG74 09 Reverse Tap Canned CycleG76 09 Fine Boring Canned CycleG77 09 Back Bore Canned Cycle

(M codes continued next page)

Page 23: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

20

JUNE 2000PROGRAMMING

Code: Group: Function:G80 * 09 Canned Cycle CancelG81 09 Drill Canned CycleG82 09 Spot Drill Canned CycleG83 09 Regular Peck Drill Canned CycleG84 09 Tapping Canned CycleG85 09 Bore in/Bore out Canned CycleG86 09 Bore in/Stop/Rapid out Canned CycleG87 09 Bore in/Manual Retract Canned CycleG88 09 Bore/Dwell/Manual Retract Canned CycleG89 09 Bore/Dwell/Bore out Canned CycleG90 * 03 AbsoluteG91 03 IncrementalG92 00 Set Work CoordinatesG93 05 Inverse Time Feed ModeG94 * 05 Feed Per Minute ModeG98 * 10 Initial Point ReturnG99 10 R Plane ReturnG100 00 Cancle Mirror ImageG101 00 Enable Mirror ImageG102 00 Programmable Output to RS-232G103 00 Limit Block Buffering (Block Lookahead)G107 00 Cylindrical MappingG110 12 Select Work Coordinate System 7G111 12 Select Work Coordinate System 8G112 12 Select Work Coordinate System 9G113 12 Select Work Coordinate System 10G114 12 Select Work Coordinate System 11G115 12 Select Work Coordinate System 12G116 12 Select Work Coordinate System 13G117 12 Select Work Coordinate System 14G118 12 Select Work Coordinate System 15G119 12 Select Work Coordinate System 16G120 12 Select Work Coordinate System 17G121 12 Select Work Coordinate System 18G122 12 Select Work Coordinate System 19G123 12 Select Work Coordinate System 20

(M codes continued next page)

Page 24: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

21

JUNE 2000 PROGRAMMING

Code: Group: Function:G124 12 Select Work Coordinate System 21G125 12 Select Work Coordinate System 22G126 12 Select Work Coordinate System 23G127 12 Select Work Coordinate System 24G128 12 Select Work Coordinate System 25G129 12 Select Work Coordinate System 26G136 00 Automatic Work Offset Center MeasurementG141 07 3D+ Cutter CompensationG143 08 5 Axis Tool Length Compensation (optional)G150 00 General Purpose Pocket MillingG174 00 Special Purpose Rigid Tapping CCWG184 00 Special Purpose Rigid Tapping CWG187 00 Accuracy Control for High Speed Machining

Each G code defined in this control is part of a group of G codes. The Group 0 codesare non-modal; that is, they specify a function applicable to that block only and donot affect other blocks. The other groups are modal and the specification of onecode in the group cancels the previous code applicable from that group. A modal Gcode applies to all subsequent blocks so those blocks do not need to re-specify thesame G code.

There is also one case where the Group 01 G codes will cancel the Group 9 (cannedcycles) codes. If a canned cycle is active (G73 through G89), the use of G00 or G01will cancel the canned cycle.

Page 25: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

22

JUNE 2000PROGRAMMING

MACHINE DEFAULTS

A default is an automatic function of the machine tool control. After powering up themachine, the control will recognize the default �G� code values. The machine willgo to the part zero that was entered in for G54 if no other work coordinate code wasspecified in the actual program, because the machine automatically recognizes theG54 column upon start-up. That is a default. The defaults for the Haas mill areindicated by an asterisk ( * ) in the "Preparatory Functions (G Codes)" list of thisworkbook.

The control automatically recognizes these G codes when your HAAS mill ispowered up:

G00 Rapid TraverseG17 X,Y Circular Plane SelectionG20 Verify Inch (Setting 9 will need to be on INCH)G40 Cutter Compensation CancelG49 Tool length Compensation CancelG50 G51 CancelG54 Work Coordinate Zero #1 (1 of 26 available)G64 Exact Stop CancelG69 G68 Cancel (optional)G80 Canned Cycle CancelG90 Absolute ProgrammingG94 Inverse Time Feed DeactivateG98 Initial Point Return

There is no default feedrate (F code), but once an F code is programmed, it willapply until another feedrate is entered or the machine is turned off.

Page 26: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

23

JUNE 2000 PROGRAMMING

CANNED CYCLES

A canned cycle is used to simplify programming of a part. Canned cycles aredefined for most common Z-axis repetitive operations such as drilling, tapping, andboring. Once selected, a canned cycle is active until canceled with the G80 code.There are six operations involved in every canned cycle:

1) Positioning of X and Y axes (optional A, rotary axis).2) Rapid traverse to the reference plane.3) Drilling, boring, or tapping action.4) Operation at the bottom of the hole.5) Retraction to the reference plane.6) Rapid traverse to the initial starting point.

Canned cycle will only be executed in the Z-axis when positioning to a new X and/or Y axis position after a canned cycle is selected. G98 and G99 are modalcommands which change the way a canned cycle operates. G98 (default) willcause Z-axis to return to the initial starting point, and G99 will return Z-axis to theR (reference) plane after a cycle has been executed and positions to a new locationto execute another cycle.Listed below are the canned cycles that are available, To see the start of thedetailed descriptions listed for each of these canned cycles, see page 69.

G73 High Speed Peck Drill Canned CycleG74 Reverse Tap Canned CycleG76 Fine Boring Canned CycleG77 Back Bore Canned CycleG80* Canned Cycle CancelG81 Drill Canned CycleG82 Spot Drill Canned CycleG83 Peck Drill Canned CycleG84 Tapping Canned CycleG85 Boring Canned CycleG86 Bore/Stop Canned CycleG87 Bore/Manual Retract Canned CycleG88 Bore/Dwell/Manual Retract Canned CycleG89 Bore/Dwell/Canned Cycle

Page 27: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

24

JUNE 2000PROGRAMMING

ALPHABETICAL ADDRESS CODESThe following is a list of the Address Codes used in programming the Mill.

A FOURTH AXIS ROTARY MOTIONThe A address character is used to specify motion for the optional fourth, A, axis. Itspecifies an angle in degrees for the rotary axis. It is always followed by a signednumber and up to three fractional decimal positions. If no decimal point is entered,the last digit is assumed to be 1/1000 degrees.

B FIFTH AXIS ROTARY MOTIONThe B address character is used to specify motion for the optional fifth, B, axis. Itspecifies an angle in degrees or the rotary axis. It is always followed by a signednumber and up to three fractional decimal positions. If no decimal point is entered,the last digit is assumed to be 1/1000 degrees.

C AUXILIARY EXTERNAL ROTARY AXISThe C address character is used to specify motion for the optional external sixth, C,axis. It specifies an angle in degrees for the rotary axis. It is always followed by asigned number and up to three fractional decimal positions. If no decimal point isentered, the last digit is assumed to be 1/1000 degrees.

D TOOL DIAMETER OFFSET SELECTIONThe D address character is used to select the tool diameter or radius used for cuttercompensation. The number following must be between 0 and 100. The Dn selectsthat number offset register, that is in the offset display, which contains the tooldiameter/radius offset amount when using cutter compensation (G41 G42). D00 willcancel cutter compensation so that the tool size is zero and it will cancel anypreviously defined Dn.

E CONTOURING ACCURACYThe E address character is used, with G187, to select the accuracy required whencutting a corner during high speed machining operations. The range of valuespossible is 0.0001 to 0.25 for the E code. Refer to the �Contouring Accuracy�section of your machine manual for more information.

F FEED RATEThe F address character is used to select the feed rate applied to any interpolationfunctions, including pocket milling and canned cycles. It is either in inches per minutewith four fractional positions or mm per minute with three fractional positions.

G PREPARATORY FUNTIONS (G codes)The G address character is used to specify the type of operation to occur in the blockcontaining the G code. The G is followed by a two or three digit number between 0

Page 28: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

25

JUNE 2000 PROGRAMMING

and 187. Each G code defined in this control is part of a group of G codes. The Group0 codes are non-modal; that is, they specify a function applicable to this block onlyand do not effect other blocks. The other groups are modal and the specification ofone code in the group cancels the previous code applicable from that group. Amodal G code applies to all subsequent blocks so those blocks do not need to re-specify the same G code. More than one G code can be placed in a block in orderto specify all of the setup conditions for an operation.

H TOOL LENGTH OFFSET SELECTIONThe H address character is used to select the tool length offset entry from the offsetsmemory. The H is followed by a two digit number between 0 and 100. H0 will clearany tool length offset and Hn will use the tool length entered in on n from the Offsetdisplay. You must select either G43 or G44 to activate a tool length (H) offsets. TheG49 command is the default condition and this command will clear any tool lengthoffsets. Reset and M30 will also cancel tool length offsets.

I CIRCULAR INTERPOLATION OR CANNED CYCLE DATAThe I address character is used to specify data for either canned cycles or circularmotions. It is defined in inches with four fractional positions or mm with threefractional positions.

J CIRCULAR INTERPOLATION OR CANNED CYCLE DATAThe J address character is used to specify data for either canned cycles or circularmotions. It is defined in inches with four fractional positions or mm with threefractional positions.

K CIRCULAR INTERPOLATION OR CANNED CYCLE DATAThe K address character is used to specify data for either canned cycles or circularmotions. It is defined in inches with four fractional positions or mm with threefractional positions.

L LOOP COUNT TO REPEAT COMMAND CYCLESThe L address character is used to specify a repeat count for some canned cyclesand auxiliary functions. It is followed by a number between 0 and 32767.

M M CODE MISCELLANEOUS FUNCTIONSThe M address character is used to specify an M code. These codes are used tocontrol miscellaneous machine functions. Note that only one M code is allowed perblock in a CNC program and all M codes are performed secondary in a block.

N NUMBER OF BLOCKThe N address character is entirely optional. It can be used to identify or numbereach block of a program. It is followed by a number between 0 and 99999. The M97functions needs to reference an N line number.

Page 29: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

26

JUNE 2000PROGRAMMING

O PROGRAM NUMBERThe O address character is used to identify a program. It is followed by a numberbetween 0 and 99999. A program saved in memory always has a Onnnnn identifi-cation in the first block. Altering the Onnnnn in the first block causes the programto be renumbered. If you put a (program name) between parenthesis in the first threelines in your program, that program name will also be seen in your program list. Youcan have up to 200 program numbers in your List of Programs.

P DELAY OF TIME / PROGRAM OR SEQUENCE NUMBERThe P address character is used to enter either a time in seconds or a programnumber for a subroutine call. If it is used as a time (for a dwell time with G04 or insome canned cycles) or as a program sequence number reference (for a M97), ora program reference number (for a M98) the value is a positive number withoutdecimal point up to 9999 when used with an M98. If it is used as a dwell time, it maybe a positive decimal with fraction between 0.001 and 1000.0.

Q CANNED CYCLE OPTIONAL DATAThe Q address character is used in canned cycles and is always a positive numberin inches between 0.001 and 100.0.

R CIRCULAR INTERPOLATION OR CANNED CYCLE DATAThe R address character is used in canned cycles or circular interpolation. It'seither in inches with four fractional positions or mm with three fractional positions.It is followed by number in inches or metric. It's usually used to define the referenceplane for canned cycles.

S SPINDLE SPEED COMMANDThe S address character is used to specify the spindle speed in conjunction withM41 and M42. The S is followed by an unsigned number between 1 - 99999. The Scommand does not turn the spindle on or off; it only sets the desired speed. If a gearchange is required in order to set the commanded speed, this command will causea gear change to occur even if the spindle is stopped. If spindle is running, a gearchange operation will occur and the spindle will start running at the new speed.

T TOOL SELECTION CODEThe T address character is used to select the tool for the next tool change. Thenumber following must be a positive number between 1 and (20) the number inParameter 65. It does not cause the tool change operation to occur. The Tn may beplaced in the same block that starts tool change (M6 or M16) or in any previousblock.

Page 30: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

27

JUNE 2000 PROGRAMMING

U AUXILIARY EXTERNAL LINEAR AXISThe U address character is used to specify motion for the optional external linear,U-axis. It specifies a position of motion in inches. It is always followed by a signednumber and up to four fractional decimal positions. If no decimal point is entered,the last digit is assumed to be 1/10000 inches. The smallest magnitude is 0.0001inches, the most negative value is -8380.0000 inches, and the largest number is8380.0000 inches.

V AUXILIARY EXTERNAL LINEAR AXISThe V address character is used to specify motion for the optional external linear,V-axis. It specifies a position of motion in inches. It is always followed by a signednumber and up to four fractional decimal positions. If no decimal point is entered,the last digit is assumed to be 1/10000 inches.

W AUXILIARY EXTERNAL LINEAR AXISThe W address character is used to specify motion for the optional external linear,W-axis. It specifies a position of motion in inches. It is always followed by a signednumber and up to four fractional decimal positions. If no decimal point is entered,the last digit is assumed to be 1/10000 inches.

X LINEAR X-AXIS MOTIONThe X address character is used to specify motion for the X-axis. It specifies aposition or distance along the X-axis. It is either in inches with four fractionalpositions or mm with three fractional positions. It is followed by a signed number ininches or metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or 1/1000 mm.

Y LINEAR Y-AXIS MOTIONThe Y address character is used to specify motion for the Y-axis. It specifies aposition or distance along the Y-axis. It is either in inches with four fractionalpositions or mm with three fractional positions. It is followed by a signed number ininches or metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or 1/1000 mm.

Z LINEAR Z-AXIS MOTIONThe Z address character is used to specify motion for the Z-axis. It specifies aposition or distance along the Z-axis. It is either in inches with four fractionalpositions or mm with three fractional positions. It is followed by a signed number ininches or metric. If no decimal point is entered, the last digit is assumed to be 1/10000 inches or 1/1000 mm.

Page 31: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

28

JUNE 2000PROGRAMMING

RAPID POSITION COMMANDS

G00 Rapid Positioning MotionX Optional X-axis motion commandY Optional Y-axis motion commandZ Optional Z-axis motion commandA Optional A axis motion command

This G code is for rapid traverse of the three or four axes of the machine.This G00 code is modal and causes all the following blocks to be in rapid (710in./min.) motion until another Group 01 code is specified. Generally, rapidmotions "will not" be in a straight line. All the axes specified are moved at themaximum speed and will not necessarily complete each axis move at the sametime. So you need to be careful of any obstructions to avoid with this type ofrapid move. The tool will first move from the current position in a straight linealong a 45 degree angle to an intermediate location when one of these axes hascompleted its move. Then the machine will position parallel to the X or Y axisto complete the move to the final location. If the Z axis is also in the programmove, it will operate in the same manner along with the X and Y axes. Onlythe axes specified are moved and the commands for absolute (G90) orincremental (G91) will change how those values are interpreted.

ABSOLUTE POSITIONING - G90 G00 X2.25 Y1.25OR

INCREMENTAL POSITIONING - G91 G00 X5.25 Y2.25

Y-

X-

Y+

X+

Page 32: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

29

JUNE 2000 PROGRAMMING

INTERPOLATION COMMANDS

G01 Linear Interpolation MotionX Optional X-axis motion commandY Optional Y-axis motion commandZ Optional Z-axis motion commandA Optional A axis motion commandF Feed rate in inches (mm) per minute

This G code provides for straight line (linear) motion from point to point. Motion canoccur in 1, 2 or 3 axes. All axes start and finish motion at the same time. The rotaryaxis may also provide motion around an axis or center point. The speed of all axesare controlled by a feedrate specified along with axis moves. Rotary axis feedrateis dependent on rotary axis diameter setting (Setting 34) and will provide acontrolled motion. The F command is modal and may be specified in a previousblock. Only the axes specified are moved in either absolute (G90) or incremental(G91) modal commands which change how values are interpreted.

Location are defined around partgeometry using cutter comp.

(Absolute with Cutter Comp.)G90 G41 G01 X0. F12.

Y2.25X1. Y3.25X2.25.........OR

(Incremental with Cutter Comp.)G91 G41 G01 X0. F12.

Y2.25X1. Y1.X1.0.........

Page 33: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

30

JUNE 2000PROGRAMMING

CIRCULAR INTERPOLATION COMMANDS

G02 CW CIRCULAR INTERPOLATION MOTIONX End point X-axis Motion commandY End point Y-axis Motion commandZ End point Z-axis Motion commandA End point A-axis Motion commandI Distance from start point to arc center in X-axis (optional)J Distance from start point to arc center in Y-axis (optional)K Distance from start point to arc center in Z-axis (optional)R Radius of the arc to be machined (If I, J, K are not used)F Feed rate in inches (or mm) per minute

G03 CCW CIRCULAR INTERPOLATION MOTIONG03 will generate a counterclockwise circular motion, but is otherwise defined thesame way as G02.

These G codes are used to specify a clockwise or counterclockwise motion of two,of the linear axes. Circular motion is possible in two of the three axes in either theX, Y, and/or Z axes as selected by G17, G18, and G19. The X, Y, and Z in a circularcommand (G02 or G03) is used to define the end point of that motion in eitherabsolute (G90) or incremental (G91) motion. If any of the axes, X, Y, or Z for theselected plane is not specified, the endpoint location of the arc will then berecognized the same as the starting point of the arc, for that axis. There are twobasic command formats for defining circular interpolation, depending on whetherthe IJK method or the R method is used to define the arc center.

Circular interpolation commands are used to move a tool along a circular arc to thecommanded end position. Five pieces of information are required for executing acircular interpolation command:

1. Plane selection2. Arc start position coordinates3. Rotation direction4. Arc end position coordinates5. Arc center coordinates or arc radius.

G02

R

I

J

Page 34: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

31

JUNE 2000 PROGRAMMING

There are two ways to specify the center of the circular arc that your rotating around:the first uses I, J, or K to specify the distance from the starting point to the center ofthe arc: the second uses R to specify the radius of the arc. These two ways will befurther described below:

The "I", "J" and "K" values are "INCREMENTAL" distances from the tools startingpoint (START POINT) on the arc to the ARC CENTER.

"I" = incremental distance from Start Point to arc center in the "X axis"."J" = incremental distance from Start Point to arc center in the "Y axis"."K" = incremental distance from Start Point to arc center in the "Z axis".

When R is used, a complete 360 degree arc is not possible. X, Y, or Z is requiredto specify an endpoint different from the starting point. R is the distance from thestarting point to the center of the circle. With a positive R, the control will generatea circular path of 180 degrees or less, but to generate a circular path of over 180degrees, specify a negative R.

55555

44444

33333

22222

11111

Item Command RemarkPlane selection command G17 Arc parrallel to XY-planePlane selection command G18 Arc parrallel to ZX-planePlane selection command G19 Arc parrallel to YZ-planeArc start position coordinates X,Y,Z Coordinates of the start positionRotation direction G02 Clockwise direction

G03 Counterclockwise directionArc end position (G90) Absolute X,Y,Z Coordinates of the end position on the

or work coordinate systemArc end position (G91) Incremental X,Y,Z Distance from start position to end

position in X, Y, and Z axes, respectivelyI J K method (arc center coordinate) I,J,K Distance from start position to arc

or center in X, Y, and Z axes, respectivelyR method (arc radius) R Arc radius value

The Five pieces of information for executing a circular interpolation command.

G03

R

I

J

Page 35: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

32

JUNE 2000PROGRAMMING

G02 CIRCULAR INTERPOLATION CLOCKWISE

Contouring a part profile using a circular interpolation command, uses the axisinformation contained in a block, to move the tool in a CLOCKWISE circular move,up to 360 degrees.

The velocity at which the tool is moving is controlled by the feedrate ( F ) command.

All circles are defined and machined by programming in three pieces of informationto the control, they are :

START POINT of the arc

END POINT of the arc

ARC CENTER incremental distance from the start point to the arc center.

The START POINT is the point defined prior to the G02 line, usually by a G01linear positioning move.

The END POINT is defined by the "X" and "Y" coordinates contained in theG02 line, when in the G17- XY PLANE.

The ARC CENTER is defined in the G02 line with the "I" for the Xaxis and "J"for the Y axis incremental distance and direction to the arc center, when in theG17- XY PLANE. Or by the "R" Radius value.

N5 G01 Y1.250 F12.N6 X1.500 (to start point)N7 G02 X2.250 Y.500 (I0. J-.750 or R.750)

Page 36: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

33

JUNE 2000 PROGRAMMING

G02 CIRCULAR INTERPOLATION CLOCKWISEUSING "I", "J" AND "K"

The "I", "J" and "K" values are INCREMENTAL distances from where the tool startscutting the arc (START POINT) to the ARC CENTER.

When I, J, or K are used to specify the center of the arc, R is not used. Only the I, J,or K specific to the selected plane (IJ for G17, IK for G18, JK for G19) are allowed.If only one of the I, J, K is specified, the others are assumed to be zero. The I, J, orK is the distance from the starting point to the center of the circle. Use of I, J, or Kis the only way to cut a complete 360 degree arc; in this case, the starting point isthe same as the ending point and no X, Y, or Z is needed. To cut a complete circleof 360 degrees (360O), you do not need to specify an ending point X, Y, or Z; justprogram I, J, or K to define the center of the circle.

NOTE: Example of circular moves are not using cutter compensation, so the circularmoves are defined from the center of the cutter around arc. For 90 degree cornersor fillets the "I" and "J" values can be defined like you see below.

START

START

XY ORIGIN

ARC CENTERARC CENTER

G01X1.5G02 X2.25 Y1.5 I0 J-.75

G01Y1.75G02 X-1.75 Y2.25 I.5 J0

ARC CENTERARC CENTER START

END POINT

G01 X-1.G02 X-2.25 Y-1. I0 J1.25 G01 Y-1.25

G02 X1.25 Y-2.25 I-1. J0

END POINT

1/2 END MILLSTART POINTEND POINT

END POINT

Page 37: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

34

JUNE 2000PROGRAMMING

G02 CW CIRCULAR MOTION USING "R"

The letter address "R" can be substituted for the letter addresses "I" , "J" and/or "K"for various corners or fillets and the "R" value is more easily defined.

Just as "I" "J" and "K", are used to locate the ARC CENTER in relation to the STARTPOINT , "R" does the same function with less input.

When R is used to specify the center of the circle, a complete 360 degree arc isnot possible. When defining an arc less then 360 degrees using the R command,the X, Y, or Z needs to specify an endpoint different from the starting point. And Rdefines the distance from the starting point to the center of the circle. With a positiveR, the control will generate a radius of 180 degrees or less; to generate a radius ofover 180 degrees, you need to specify an R command with a negative value.

NOTE: Example of circular moves are not using cutter compensation, so the circularmoves are defined from the center of the cutter around arc. For 90 degree cornersor fillets the "R" values can be defined like you see below.

G01 Y-1.25G02 X1.25 Y-2.25 R1.

END POINT

XY ORIGIN

START POINT

G01X1.5G02 X2.25 Y1.5 R.75

G01Y1.75G02 X-1.75 Y2.25 R.5

ARC CENTERARC CENTER

ARC CENTERARC CENTEREND POINT

START POINT END POINT

G01 X-1.G02 X-2.25 Y-1. R1.25

START POINT

START POINTEND POINT1/2 END MILL

Page 38: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

35

JUNE 2000 PROGRAMMING

G03 CIRCULAR INTERPOLATION COUNTER-CLOCKWISE

Contouring a part profile using a circular interpolation command, uses the axisinformation contained in a block, to move the tool in a CLOCKWISE circular move,up to 360 degrees.

The velocity at which the tool is moving is controlled by the feedrate ( F ) command.

All circles are defined and machined by programming in three pieces of informationto the control, they are :

START POINT of the arc

END POINT of the arc

ARC CENTER incremental distance from the start point to the arc center.

The START POINT is the point defined prior to the G02 line, usually by a G01linear positioning move.

The END POINT is defined by the "X" and "Y" coordinates contained in theG02 line, when in the G17- XY PLANE.

The ARC CENTER is defined in the G02 line with the "I" for the Xaxis and "J"for the Y axis incremental distance and direction to the arc center, when in theG17- XY PLANE. Or by the "R" Radius value.

N5 G01 Y1.250 F12.N6 X-1.500 (to start point)N7 G03 X-2.250 Y.500 (I0. J-.750 or R.750)

Page 39: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

36

JUNE 2000PROGRAMMING

G03 CIRCULAR INTERPOLATION COUNTER-CLOCKWISE USING "I", "J" AND "K"

The "I", "J" and "K" values are INCREMENTAL distances from where the tool startscutting the arc (START POINT) to the ARC CENTER.

When I, J, or K are used to specify the center of the arc, R is not used. Only the I, J,or K specific to the selected plane (IJ for G17, IK for G18, JK for G19) are allowed.If only one of the I, J, K is specified, the others are assumed to be zero. The I, J, orK is the distance from the starting point to the center of the circle. Use of I, J, or Kis the only way to cut a complete 360 degree arc; in this case, the starting point isthe same as the ending point and no X, Y, or Z is needed. To cut a complete circleof 360 degrees (360O), you do not need to specify an ending point X, Y, or Z; justprogram I, J, or K to define the center of the circle.

NOTE: Example of circular moves are not using cutter compensation, so the circularmoves are defined from the center of the cutter around arc. For 90 degree cornersor fillets the "I" and "J" values can be defined like you see below.

ARC CENTERARC CENTER

ARC CENTERG01 X-1.75G03 X-2.25 Y1.75 I0 J-.5

ARC CENTER

G01 X1.25G03 X2.25 Y-1.25 I0 J1.

G01 Y-1.G03 X-1. Y-2.25 I1.25 J0

XY ORIGIN

G01 Y1.5G03 X1.5 Y2.25 I-.75 J0

1/2 END MILLSTART POINT

END POINT

START POINT

START POINT

END POINT

END POINT

END POINT

START POINT

Page 40: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

37

JUNE 2000 PROGRAMMING

G03 CCW CIRCULAR MOTION USING "R"

The letter address "R" can be substituted for the letter addresses "I" , "J" and/or "K"for various corners or fillets and the "R" value is more easily defined.

Just as "I" "J" and "K", are used to locate the ARC CENTER in relation to the STARTPOINT , "R" does the same function with less input.

When R is used to specify the center of the circle, a complete 360 degree arc isnot possible. When defining an arc less then 360 degrees using the R command,the X, Y, or Z needs to specify an endpoint different from the starting point. And Rdefines the distance from the starting point to the center of the circle. With a positiveR, the control will generate a radius of 180 degrees or less; to generate a radius ofover 180 degrees, you need to specify an R command with a negative value.

NOTE: Example of circular moves are not using cutter compensation, so the circularmoves are defined from the center of the cutter around arc. For 90 degree cornersor fillets the "R" values can be defined like you see below.

ARC CENTERARC CENTER

ARC CENTERG01 X-1.5G03 X-2.25 Y1.5 R.5

ARC CENTER

G01 X1.5G03 X2.25 Y-1.5 R1.0

G01 Y-1.5G03 X-1.5 Y-2.25 R1.25

XY ORIGIN

G01 Y1.5G03 X1.5 Y2.25 R.75

1/2 END MILLEND POINT

START POINT

START POINT

END POINT

START POINT

START POINT

END POINT

END POINT

Page 41: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

38

JUNE 2000PROGRAMMING

The following line will cut an arc lessthan 180 degrees (180o) using a posi-tive R value:

G90 G54 G00 X-0.25 Y-0.25G01 Y1.5 F12.G02 X1.884 Y2.384 R1.25

To generate an arc of over180 degrees you need to specify anegative R value(1800) using an Rminus:

G90 G54 G00 X-0.25 Y-0.25G01 Y1.5 F12.G02 X1.884 Y0.616 R-1.25

A complete 360 degree arc using anR command is not possible. To do a360 degree arc in a G02 or G03 youneed to use I and/or J to define thecenter of a circle for a complete 360degree arc.

G03 CCW Circular Interpolation MotionG03 will generate counterclockwise circular motion but is otherwisethe same as G02.

Page 42: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

39

JUNE 2000 PROGRAMMING

INTERPOLATION EXERCISE

O00010 (INTERPOLATION EXERCISE)T1 M06 (1/2 DIA. 2 FLT. END MILL)G90 G54 G00 X_______ Y______S1400 M03G43 H01 Z0.1 M08G01 Z_______ F50. (feed fast to depth non-cutting move)X_______ F10. (feed onto left side of part programming to the center of tool)Y______ (feed up to the upper left radius and continue around part to the end)G0__ X______ Y______ (either I_____ J_____ or R_____ not both)G0__ X_______G0__ X______ Y______ (either I_____ J_____ or R_____ not both)G0__ Y_______X_______G0__ X______ Y______ (either I_____ J_____ or R_____ not both)G0__ Y_______X_______G00 Z1. M09G28 G91 Z0. M05M30

Cutter will be a.500 dia. end mill.Start contour fromthe lower left cor-ner of part andmill around out-side of part .625deep. When de-fining a circularmove (G02 orG03) you can useeither an IJK oran R commandbut not both. Millaround outside ofpart with tool bydefining the verycenter of the cut-ter to posi t ionaround part.

Page 43: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

40

JUNE 2000PROGRAMMING

PROGRAM START-UP LINES

T1 M06 T1 - Selects tool number one to be loadedinto the spindle.

M06 -Activates the tool change sequence.

G90 G54 G00 X____ y____G90 - Activates control to be in ABSOLUTE.G54 - Selects work coordinate system No. 1G00 - Preparatory function for RAPID.X___-Axis move to initial "X" position.Y___-Axis move to initial "Y" position.

S1200 M03 S1200 - Informs the control that 1200 hasbeen selected as the RPM for this tool.

M03- Turns the spindle "ON" in a clockwisedirection at a speed of 1200 RPM.

G43 H01 Z0.1 M08 G43 - Recognizes the tool length offset valuestored in the "Hnn" code offsetdisplay register in the offset LENGTHGeometry display.

H01 - Defines to the control which offsetregister the tool offset value is stored in.

Z0.1 - Informs the control to move from fullspindle retract to this "Z" value andapply the tool length offset.

M08 - Turns the coolant "ON".

Page 44: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

41

JUNE 2000 PROGRAMMING

PROGRAM ENDING LINES

G00 Z1. M09 G00 - Preparatory function for RAPID.Z1. - Retracts tool to 1.0 above "PART ZERO" in

preparation for full spindle retract.M09 - Turns the coolant "off".

G28 G91 Y0. Z0. M05 G28 - This preparatory function causes areturn to machine zero of all axes. If anX,Y and Z are specified, only those axisspecified will be moved.

G91 - Preparatory function for INCREMENTALmode, which is required for rapid move tothe G28 reference point. G28 also cancelstool length compensation.

--------- USING G53 TO SEND MACHINE HOME INSTEAD OF G28 G91 ---------

G53 G49 Y0. Z0. M05 G53 - This preparatory function temporarily cancelsworks offset and positions the machine axesfrom machine home. It is non-modal; so thenest block will revert back to the previoulyselected work offset.

G49 - This preparatory function cancels tool lengthcompensation.

--------------------------------------------------------------------------------------------------------------Y0. - This will select the Y axis to position the

table toward you to its machine zero.Z0. - This will insures a full retract, of Z axis

in the "UP" direction to machine zeroM05 - This command will turn off spindle.

M30 M30 - Signals END OF PROGRAM ANDREWIND, to the control. The programwill reset to the first block of the programand stop. It also stops the spindle,turns off the coolant and cancels toollength offsets. It also makes the controlready for the next cycle.

Page 45: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

42

JUNE 2000PROGRAMMING

MISCELLANEOUS G CODES

G04 DwellP The dwell time in seconds or milliseconds

G04 is used to cause a delay or dwell in the program. The block containing G04 willdelay for the time specified in the P code. When programmed on a line followingsome motion such as G00, G01, G02 and G03 all motion will be stopped for theamount 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 requestedRPM, and the coolant stays on.

G04 P____Minimum value - P.001 of a secondMaximum value - P1000.0 seconds

Page 46: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

43

JUNE 2000 PROGRAMMING

CIRCULAR POCKET MILLING

There are two G codes G12 and G13 that will provide for pocket milling of a circularshape. They are different only in which direction of rotation is used. G12 and G13are non-modal.

G12 Circular Pocket Milling ClockwiseX Position in X axis to center of circular pocketY Position in Y axis to center of circular pocketZ Z depth of cut, or it's the increment depth of cuts when used with G91I Radius Of First Circle (Or it's the finish radius if K is not used)K Radius Of Finished Circle (If specified)Q Radius cut increment step-over of the spiral out (Q is used with K only)L Loop count for repeating incremental depth of cuts (L is used with G91)D* Cutter Comp. Offset Number (Enter cutter size in offset display register)F Feed Rate in inches (mm) per minuteThis G12 Code implies the use of G42

G13 Circular Pocket Milling CounterclockwiseThis G13 Code implies the use of G41 and will also be machining in acounterclockwise direction, but is otherwise the same as G12.

The tool must be positioned at the center of the circular pocket either in a previousblock or in this command using an X and Y position. The cuts are performed entirelywith circular motions of varying radiuses.

*In order to get the exact programmed circle diameter, the control uses the selectedD code tool size. If this compensation is not desired, program D0.

The G12 Code implies the use of G42 cutter compensation right.

The G13 Code implies the use of G41 cutter compensation left.

To remove all the material within the circle use an I and Q value less than the tooldiameter and a K value equal to the circle radius. G12 and G13 belongs to Groupzero and thus is non-modal.

If no K is specified, the center roughing passes of this command are removedcompletely and only one finish pass of the circular pocket is performed.

If G91 (incremental) is specified and an L count is included, the Z increment isrepeated L times at the F feed rate command.

Page 47: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

44

JUNE 2000PROGRAMMING

EXAMPLE: G13 ONE PASS "I" ONLY

O01041N1 (D01 DIA. OFFSET IS .500)N2 T1 M06 (1/2 DIA. 2 FLT END MILL)N3 G90 G54 G00 X2.5 Y2.5 (position to X Ycenter of circular pocket)N4 S3600 M03N5 G43 H01 Z0.1 M08N6 G13 Z-0.5 I0.5 D01 F15. (1.0 Dia. x .5 deep circular pocket 1 pass)N7 G00 Z1. M09N8 G28 G91 Y0 Z0N9 M30

Page 48: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

45

JUNE 2000 PROGRAMMING

EXAMPLE: G13 MULTIPLE PASSES I, K & Q

O01042N1 (D01 DIA. OFFSET IS .500)N2 T2 M06 (1/2 DIA. 2 FLT END MILL)N3 G90 G54 G00 X2.5 Y2.5 (X Y position to center location of circular pocket)N4 S3600 M03N5 G43 H02 Z0.1 M08N6 G13 Z-0.5 I0.3 K1.5 Q0.3 D02 F15. (3.0 Dia. x .5 deep circular pocket)N7 G00 Z1. M09N8 G28 G91 Y0 Z0N9 M30

EXAMPLE: G13 MULTIPLE PASSES "I" "K" & "Q" AND INCREMENTAL G91

O01042N1 (D01 DIA. OFFSET IS .500)N2 T3 M06 (1/2 DIA. 2 FLT END MILL)N3 G90 G54 G00 X2.5 Y2.5 (X Y position to center location of circular pocket)N4 S3600 M03N5 G43 H03 Z0.1 M08N6 G01 Z0. F30. (Move down to the start of part surface to begin the increment down)N7 G13 G91 Z-0.375 I .25 K2. Q .3 D03 L4 F15. (4.0 Dia. x 1.5 deep circular pocket)N8 G00 G90 Z1. M09N9 G28 G91 Y0 Z0N10 M30

The above program uses G91 and a "L" count of four. This cycle is multiplied by the "L"command and will do it a total of four times at the Z depth increment of .375 to a total depthof 1.5 in. The G91 and "L" count can also be used for G12 and G13 "I" only line.

Page 49: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

46

JUNE 2000PROGRAMMING

CIRCULAR POCKET MILLING EXERCISEG12 Circular Pocket Milling CW

orG13 Circular Pocket Milling CCW X - Position to center of pocket Y - Position to center of pocket Z - Depth of cut or increment down I - Radius of First Circle (Or the

finish radius If K is not used). K - Radius of Finished Circle

(If specified). Q - Radius step over Increment

( Must be used with K). D - Cutter Comp. Number

(Enter cutter size into offsetdisplay register number).

L - Loop Count for repeatingdeeper cuts.

F - Feedrate in inch (mm) per min.

CPM1

CPM2

Circular Pocket Mill CPM 2 which is a 2.0 Dia. x.500 dp. pocket incrementaly stepping down .25depth using an L2 count and an incremental G91command to do 2 passes on a circular pocketusing I.3, K1.0 and Q.35 for machining out pocket.

Circular Pocket Mill CPM 1 to a depth of .500spiraling out to a rough size using I.25, K.990and Q.2 for roughing out pocket. Then .Pocketmill another command to run on CPM 1 usingI1.0 only as a circular pocket finish pass.

O00020 (CIRCULAR POCKET MILLING EXERCISE)T___ M___ (T2 IS A 5/8 DIA. 2FLT. CENTER CUTTING END MILL)G___ G___ G___ X______ Y______ (Position X Ycenter of CPM1)S______ M_____G___ H____ Z_____ M___ (Rapid to .1 above part)G___ Z____ I____ K____ Q____ D___ F____ (CPM1 with I,K& Q)G___ Z_____ I_____ D____ F____ (I only for a finish pass of CPM1)G___ Z_____ (Z rapid to clearance position above part)X______ Y______ (X Y position to center of CPM2)G01 Z0. F20. (Feed down to the start point to start incremental depth down)G___ G___ Z____ I___ K___ Q___ D___ L___ F___ ( I, K, Q & G91)G___ Z_____ M___ (Rapid 1.0 above part, turn coolant off)G28 G91 Z0 M05M30

2.000 DIA. x .500 DP. 2PL.

4.00 SQ

2.750

1.250

X0 Y0 PART ORIGIN

1.250

2.750

Tool 2 is a 5/8 Dia. 2 flute end mill with a spindle speed of 1400 RPM at 8.7 feed.

Page 50: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

47

JUNE 2000 PROGRAMMING

CIRCULAR PLANE SELECTION

The plane used for circular motions must be comprised of two of the axes,X, Y, or Z. The plane selection is modal and stays in effect for all subsequentcircular interpolation moves until you command another plane selection code.There are three G codes used to select the circular plane; G17 for the XY plane,G18 for the XZ plane, and G19 for the YZ plane.

G17 XY CIRCULAR PLANE SELECTIONThe G17 code is used to select the XY plane for circular motion. In this plane,circular motion is defined as clockwise for the operator looking down onto the X-Ytable from above

O01044 (G17 XY ARC PLANE EXAMPLE)N1 T2 M06 (1/2 DIA. 2 FLT. END MILL)N2 G90 G54 G00 X4. Y3.25 S2600 M03 (X Y start point of arc)N3 G43 H02 Z0.1 M08N4 G01 Z-.5 F50.N5 G17 G02 X5.25 Y2. R1.25 F10. (G17 circular motion X Y plane)N6 G00 Z1.N7 X-.25 Y1. (G17 is default when you power up machine)N8 G01 Z-.5 F50.N9 G17 G03 X1. Y-.25 R1.25 F10. (G17 circular motion X Y plane)N10 G00 Z1. M09N11 G53 G49 Y0 Z0 M05N12 M30

Page 51: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

48

JUNE 2000PROGRAMMING

G18 ZX CIRCULAR PLANE SELECTIONThe G18 code is used to select the ZX plane for circular motion. In the X-Z plane(G18), circular motion is defined as clockwise for the operator looking from the rearof the machine out toward the control panel.

O01045 (MAIN PROGRAM G18 ZX ARC PLANE EXAMPLE)N1 T3 M06 (1/2 DIA. 2 FLT. BALL END MILL)N2 G90 G54 G00 X1.5 Y0. S2600 M03 (X Y start point of arc)N3 G43 H03 Z0.1 M08N4 G01 Z0. F20.N5 M97 P100 L80 (Local sub-program call done 80 times with L80)N6 G00 Z1. M09N7 G53 G49 Y0. Z0. M05N8 M30

(Local sub-program N100 called up by an M97 on line N5)N100 G91 G01 Y-0.01N101 G90N102 G18 G03 X3. Z0. R.75 F12. (G18 circular motion Z X plane)N103 G91 G01 Y-.01N104 G90N105 G18 G02 X1.5 Z0. R.75 F12. (G18 circular motion Z X plane)N106 M99 (An M99 will cause the program to jump back to the next

line after the M97 sub program call in the main program.)

Page 52: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

49

JUNE 2000 PROGRAMMING

G19 YZ CIRCULAR PLANE SELECTIONThe G19 code is used to select the YZ plane for circular motion. In the Y-Z plane(G19), circular motion is defined as clockwise for the operator looking across thetable from the side of the machine the control panel is mounted.

O01045 (MAIN PROGRAM G19 YZ ARC PLANE EXAMPLE)N1 T4 M06 (1/2 DIA. 2FLT BALL END MILL)N2 G90 G54 G00 X.0 Y3. S2600 M03 (X Y start point of arc)N3 43 H04 Z0.1 M08N4 G01 Z0. F20.N5 M97 P100 L80 (Local sub-program call done 80 times with L80)N6 G00 Z1. M09N7 G53 G49 Y0. Z0. M05N8 M30

(Local sub-program N100 called up by an M97 on line N5)N100 G91 G01 X-0.01N101 G90N102 G19 G03 Y1.5 Z0. R.75 F12. (G19 circular motion Y Z plane)N103 G91 G01 X-0.01N104 G90N105 G19 G02 Y3. Z0. R.75 F12. (G19 circular motion Y Z plane)N106 M99 (An M99 will cause the program to jump back to the next

line after the M97 sub program call in the main program.)

Page 53: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

50

JUNE 2000PROGRAMMING

The default plane selection when the machine is powered on is G17 for theX-Y plane. This means that circular motion in the plane of the X-Y table axis maybe programmed without first selecting G17.

A helical motion is possible with G02 or G03 by programming the linear axis whichis not in the selected plane. This third axis will be interpolated along the specifiedaxis in a linear manner while the other two axes will be moved in the circular motion.The speed of each axis will be controlled so that the helical rate matches theprogrammed feed rate.

If cutter radius compensation is selected (G41 or G42), you can only use it for X-Yplane circular motions (G17). Cutter radius compensation is not available forcircular motion in the G18 XZ or G19 YZ circular motion planes.

Page 54: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

51

JUNE 2000 PROGRAMMING

INCH / METRIC SELECTION (G20, G21)

G20 Inch programming selectionG21 metric programming selection

Selection between inch and metric programming can only be done from the Setting9. Inch programming allows displacements up to 838 inches and a resolution of0.0001 inches. Metric programming uses millimeter units with a maximum displace-ment of 8380 mm and a resolution of 0.001 mm.When in metric, the feed rate also defined as millimeters per minute with a range of1000. to 0.001 mm/min.

When jogging in metric, the speeds and units on the keypad are interpreted as mm/min but the value used is ten times larger than shown on the keypad.

The optional fourth and fifth axis programming is not effected by the selection of metric.It is always programmed in degrees. The auxiliary C axis is also always in degrees.

Changing the setting from inches to metric or back again will change the content ofany programs already stored in memory. You must reload your programs with metricvalues after changing this setting.

The standard G codes G20 and G21 are sometimes used to select between inch andmetric BUT, in this control, the G20 (inch) and G21 (mm) codes can only be used toensure that the inch/metric setting is set correctly for that program.

Page 55: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

52

JUNE 2000PROGRAMMING

RETURN TO REFERENCE POINT (G28)

G28 Return To Reference Point, set optional intermediate point

The G28 code is used to return to the machine zero position on all axes. If an X, Y,Z, or A axis is on the same block and specifies a location, only those axes will moveand return to the machines� zero reference point and the movement to the machines'zero reference point will be through that specified location. This point is called theintermediate point and is saved, if needed, for use in G29. If you do not want toposition through an intermediate point while specifying a specific axis to positionto machine zero, than add a incremental (G91) command to this line along with a Z0,Y0, and/or X0 for the specific axis you want to send to machine zero. This willcommand those axes specified to position incrementally to a zero distance as anintermediate point, and then those axes specified will then position to machinezero. Just be sure to program in an absolute (G90) command in the start-up linesfor the next tool which is usually needed for the beginning of each tool.

If no X, Y, Z, or A is specified, all axes will be moved directly to machine zero. Anyauxiliary axes (B, C,...) are returned to there machine home after the X, Y, Z, and Aaxes. G28 also cancels tool length offsets.

MACHINE TABLE

SPINDLE

G28 G91 Z0

Page 56: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

53

JUNE 2000 PROGRAMMING

CUTTER COMPENSATION

Cutter compensation is used to offset the center of the cutter, and shift it thedistance of the radius, to the specified side of the programmed path. Complex partgeometries having angled lines, lines tangent to arcs, and lines intersecting arcsinvolve substantial trigonometric computations to determine the center of the cutter.Cutter compensation involves programming the part geometry directly instead ofthe tool center. The cutter compensation commands are Cutter Comp Off (G40),Cutter Comp Left (G41), and Cutter Comp Right (G42).

G40 Cutter Comp CancelG40 will cancel the G41 or G42 cutter compensation com-mands. The tool will change from a compensated position toan uncompensated position. Programming D00 will alsocancel cutter compensation.

G41 Cutter Compensation LeftG41 will select cutter compensation left; that is the tool ismoved to the left of the programmed path to compensate forthe radius of the tool. A Dnn must also be programmed toselect the correct tool size from the DIAMETER/RADIUSoffset display register.

G42 Cutter Compensation RightG42 will select cutter compensation right; that is the tool ismoved to the right of the programmed path to compensate forthe size of the tool. A Dnn must also be programmed to selectthe correct tool size from the DIAMETER/RADIUS offsetdisplay register.

Dnn Cutter Comp value - The actual offset amount must beinput in the specified tool offset display number. On theHAAS you have 100 tool DIAMETER/RADIUS offsets to use.Usually, you will have only one cutter offset for a tool, and it's best to use the same cutter offset number as is your toolnumber. On the HAAS offset tool DISPLAY page, the twocolumns on the right side of this display are for your cutter diameter offsets. Thecutter GEOMETERY column, in the offset display, is to set your initial cutter offsetvalue and you can designate it as either, a DIAMETER value or a RADIUS value,by selecting the one you would like to use with SETTING 40. And the selection youchoose will be listed at the top of the offset geometry column. The WEAR columnon the right of the tool GEOMETERY column is for any adjustments you need tomake from the initial tool GEOMETERY offset. And these value are added togetherby the control and used as one value.

Page 57: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

54

JUNE 2000PROGRAMMING

G40 Cutter Comp Cancel G41 and G42G41 Cutter Compensation LeftG42 Cutter Compensation Right

Understanding cutter compensation can be simplified if one has a basic under-standing of manual machining. There are two common types of cutting conditionsassociated with milling machines. They are CLIMB and CONVENTIONAL cutting.

Two common rules for these types of cuts are:

If the programmed cutter path needs to mill CLIMB cutting, which is what's usuallydesired on CNC machines, since the machines are rigid enough to handle this typeof cut, and the conditions from this type of cut are usually preferred. And if it's astandard right handed tool, it will then be programmed with G41 cutter LEFT of theprogrammed path.

If the programmed cutter path needs to mill with CONVENTIONAL cutting, and it'sa standard right handed tool, it will then be programmed with G42 cutter RIGHT ofthe programmed path.

Program without cutter compensation.N101 G00 X-2.5 Y-2.0N102 G01 Z-.45 F30.N103 X-2.25 F12.N104 Y1.75N105 G02 X-1.75 Y2.25 R.5N106 G01 X1.5N107 G02 X2.25 Y1.5 R.75N108 G01 Y???? (Calculate point)N109 X???? Y-2.25 (Calculate point)N110 G01 X-1.75N111 G02 X-2.25 Y-1.75 R.75N112 G01 X-2.35

Program with cutter compensation.Dia. value for D01 would be .500in DIAMETER offset register #1.

N201 G00 X-2.5 Y-2.0N202 G01 Z-.45 F0.N203 G41 X-2. D01 F12. (turn on C.C. with an X and/or Y move)N204 Y1.75N205 G02 X-1.75 Y2. R.25N206 G01 X1.5N207 G02 X2. Y1.5 R.5N208 G01 Y-1.N209 X-.75 Y-2.N210 X-1.N211 G02 X-2. Y-1.75 R.25N212 G40 G01 X-2.35 (turn off C.C. with an X and /or Y move)

Page 58: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

55

JUNE 2000 PROGRAMMING

When programming without cutter compensation, to the center of the cutter, aproblem occurs cutting angle geometry. The cutter center must be offset to the partgeometry to maintain the cutter tangency. For example, the Y axis move from PointA to Point B must have the Delta "Y" calculated dimension added to the .75dimension. The X axis move from Point B to Point C must have the Delta "X"calculated dimension subtracted from the 1.25 dimension.

Program is to the center of the cutter manually calculating the cuttercompensation of tool.O01052N1 T1 M06 (3/4 DIA. END MILL)N2 G90 G54 G00 X-0.75 Y-0.15 (X Y positioning tool center to center)N3 S2200 M03N4 G43 H01 X0.1 M08N5 G01 Z-0.5 F50.N6 X-0.375N7 Y0.????N8 X?.???? Y1.875N9 X2.6N10 G00 Z1. M09N11 G28 G91 Y0. Z0. M05N12 M30

Page 59: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

56

JUNE 2000PROGRAMMING

If however, the programming is being done with cutter compensation in effect, themoves from Point A , to Point B, to Point C will reflect the actual geometry or partprint X and Y coordinate values. The control will offset the cutter center aroundPoint B and Point C to maintain the required cutter tangency.

O01053 (Programming part using cutter compensation)N1 T1 M06 (3/4 DIA. END MILL)N2 G90 G54 G00 X-0.575 Y-0.2 (X Y position to the center of tool)N3 S2200 M03N4 G43 H01 Z0.1 M08N5 G01 Z-0.5 F50.N6 G41 X0. D01 F12. (Turning on Cutter Compensation)N7 Y0.75N8 X1.25 Y1.5N9 X2.6N10 G40 X2.7 Y1.95 (When canceling C.C. position to the X Y center of tool)N11 G00 Z1. M09N12 G28 G91 Y0. Z0. M05N13 M30

When the part has been programmed using cutter compensation we are, in effect,programming with a zero diameter cutter, to the center of the tool. The tool diametervalue is entered in on the OFFSET display page under the RADIUS/DIAMETERgeometry offset column. The control will position the tool the offset amount, off ofthe programmed part line that is programmed so that the edge of the tool ispositioning around the part geometry.

Page 60: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

57

JUNE 2000 PROGRAMMING

If, at the time of setup, the cutting tool requested by the planning is for a diameternot available currently in your shop, then input the available size on the offset page.DO NOT change the program. Cutter compensation takes the stored value for thediameter and calculates the cutter path offset from that value.

If a larger tool is going to be used, you will need to make sure that you change thestarting and ending positions so that the distance of the cutter is positioned half thediameter off the part for clearance when you lead onto and off of the part.

Machining part with C.C. using an undersize tool.O01053N1 T1 M06 (1/2 DIA. END MILL)N2 G90 G54 G00 X-0.5 Y-0.15 (Positioning X Y Center location of tool)N3 S2200 M03N4 G43 H01 Z0.1 M08N5 G01 Z-0.5 F50.N6 G41 X0. D01 F12. (Turning on Cutter Compensation)N7 Y0.75N8 X1.25 Y1.5N9 X2.6N10 G40 X2.95 Y2.N11 G00 Z1. M09N12 G28 G91 Y0. Z0. M05N13 M30

Page 61: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

58

JUNE 2000PROGRAMMING

NOTE: Advantage of cutter compensation can be taken when a rough and finishpass must be done with one tool. As we have seen, if we program the finishgeometry and use cutter compensation, we will get a finish pass.

If however, prior to the rough pass, we input a diameter offset value that is oversizeto the physical size of the end mill, and then program the finish geometry, the controlwill offset the end mill more, leaving stock for a finish pass. Then program the sameend mill using another offset with the correct offset value and the same geometry.

EXAMPLE: If the cutter is .500 diameter, and you want to leave .010 stock for afinish pass. Then enter a diameter offset number (Dn) command for tool DIAMETERGeometry of .520 for machining a roughing pass around part. And then defineanother pass around part using the same program coordinates but a differentdiameter offset number (Dn), and enter in the correct diameter offset value of .500to machine part to the finish size.

TOOL 1 HAS .520 IN D21AND .500 IN D01

O01052N1 T1 M06N2 G90 G54 G00 X-2.5 Y-2. S1600 M03N3 G43 H01 Z0.1 M08N4 G01 Z-0.45 F30.N5 G41 X-2. D21 F12. (C.C. on using D21)N6 Y1.5N7 G02 X-1.75 Y2. R0.25N8 G01 X1.5N9 G02 X2. Y1.5 R0.5N10 G01 Y-1.N11 X-.75 Y-2.N12 X-1.75N13 G02 X-2. Y-1.75 R0.25N14 G40 G01 X-2.35 Y-2. (Turn off C.C. with an X and/or Y move off of part and then do a finishpass around part using the same part geometry but a different C.C. offset.)N15 G41 X-2. D01 F8. (Turn on C.C. using D01 for a finish pass using the same program geometery.)N16 Y1.5N17 G02 X-1.75 Y2. R0.25N18G01 X1.5N19 G02 X2. Y1.5 R0.5N20 G01 Y-1.N21 X-.75 Y-2.N22 X-1.75N23 G02 X-2. Y-1.75 R0.25N24 G40 G01 X-2.35 Y-2. (Turn off C.C. with an X and/or Y move off of part.)N25 G00 Z1. M09N26 G28 G91 Z0 Y0 M05N27 M30

Page 62: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

59

JUNE 2000 PROGRAMMING

CUTTER COMPENSATION EXERCISE #1

Cutter is a 1/2 dia. End Mill. Mill around outside of part .625 deep usingcutter comp.O00030 (CUTTER COMPENSATION EXERCISE #1)T1 M06 (1/2 DIA. 4FLT. END MILL)G90 G54 G00 X_______ Y______ (Position with the center of tool)S1400 M03G43 H01 Z0.1 M08G01 Z_______ F50. (Fast feed to depth non-cutting move)G___ X_______ D____ F10. (Turn on C.C. moving onto part)Y_______G0__ X_______ Y_______ R_______G0__ X_______G0__ X_______ Y_______ R_______G0__ Y_______G0__ X_______ Y_______ R_______G0__ X_______ (Position off part at least half the cutter diameter)G___ X________ Y_______ (Turn off C.C. moving off the part)G00 Z1. M09G91 G28 Z0 M05M30

Cutter will be a.500 dia. end mill.Start contour fromthe lower left cor-ner of part and millaround outside ofpart .625 deep.Mill around outsideof part using cuttercompensation forcutter offset andthen define the ac-tual geometry ofthe part to positiontool around part.

Page 63: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

60

JUNE 2000PROGRAMMING

ADVANTAGES OF CUTTER COMPENSATION1. The mathematical computations for determining a tool path are greatly simplified.

2. Because the geometry and not the tool center is programmed, the same program can be used for a variety of different cutter diameters.

3. When using cutter compensation you are then able to control and adjust for partdimensions using your cutter diameter/radius offsets register.

4. The same program path can be used for the roughing passes as well as finishingcuts by using different cutter offset numbers.

SOME RESTRICTIONS WITH CUTTER COMPENSATION

1. A cutter compensation command (G41, G42 or G40) must be on the same blockwith an X and/or Y linear command when moving onto or off of the part using cuttercomp. You cannot turn on or off cutter compensation with a Z axis move.

2. You can use cutter comp. in the G18 (X,Z) or G19 (Y,Z) planes using G141.

3. You cannot turn ON or OFF cutter compensation in a G02 or G03 circular move,it must be in a linear G00 or G01 straight line move.

WHEN ACTIVATING CUTTER COMPENSATION, CARE MUST BE TAKEN TO:

1. Select a clearance distance without cutter compensation to a start point in "X"and "Y" axis, at least half the cutter diameter, off the part before you start initiatingcutter compensation.

2. Bring the "Z" axis down without cutter compensation in effect.

3. Make an X and/or Y axis move with a G41 or G42 call-out on the same line, witha diameter offset Dnn command, which has the cutter diameter value in the offsetdisplay register being used.

WHEN DEACTIVATING CUTTER COMPENSATION, CARE MUST BE TAKEN TO:

1. Select a clearance point in "X" and/or "Y" axis off the part.

2. "DO NOT" cancel cutter compensation on any line that is still cutting the part.

3. Cancel of cutter compensation may be a one or two axis move.

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 thelocation you want, or remain fixed and not move during the cancel (G40) process.This is a programming technique that may be a programmer's preference. The codecan be written with only a one axis move, but the programmer should be aware ofthe results. If only one of the axes, X or Y, is on the cancel (G40) command line, thecontrol will move both axes during the cancel process. And the machine willposition the axis that was not defined back to center position of that tool to the lastknown axis coordinate values.

Page 64: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

61

JUNE 2000 PROGRAMMING

Page 65: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

62

JUNE 2000PROGRAMMING

CUTTER COMPENSATION EXERCISE #2

To program this part profile, use the .750 diameter end mill, starting at the lower lefthand corner. Use CUTTER RADIUS COMPENSATION, and Climb cut part profile,with only one finish pass .450 deep.

(Use the HAAS calculator to get the spindle speed and feed)

TOOL 1 - 3/4 DIA. 4 FLT. END MILL Surface Speed (FPM) - 190.Chip Per Flute - .0025

Page 66: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

63

JUNE 2000 PROGRAMMING

CUTTER COMPENSATION EXERCISE #2

O00040 (CUTTER COMPENSATION EXERCISE #2)_______________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Page 67: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

64

JUNE 2000PROGRAMMING

THREAD MILLING WITHHELICAL MOTION

Thread milling uses a cutter formed with thepitch of the thread to be cut. The cutters aresolid carbide, fragile and expensive.

Thread milling is accomplished with Helicalmilling. Use a standard G02 or G03 move tocreate the circular move in the X-Y axis andthen insert a Z move on the same blockcorresponding to the thread pitch. This willgenerate one turn of the thread. If you areusing a multiple tooth cutter, it will generatethe rest of the thread depth. The speed ofeach axis will be controlled so that the heli-cal rate matches the programmed feed rate.

Thread milling can be used to machine largerinternal or external threads. You can alsothread mill, port threads, blind hole threads,metric threads and most all the special typeof threads that are good to thread mill. Youcan also adjust for the thread size usingdiameter compensation. 2-12 UN 3B

Minor Dia. - 1.9100/1.9198

To do a copmlete 360 degree thread pass using a G02 or G03 you need to use anI and/or J to define the center of a circle for a complete thread pass. Because youcannot do a 360 degree arc using an R command.

N1 T1 M06 (1.0 dia. single point thread tool to do a 2.0-12 thread)N2 G90 G54 G00 X1.6 Y-1.25N3 S1500 M03N4 G43 H01 Z.1 M08N5 G01 Z-.8 F50.N6 G41 X2.25 D01 F10. (Move over to thread and turn on C.C.)N7 G91 G03 X0 Y0. I-1. J0. Z.0833 F3. L10 (Repeat 10x to mill thread)N8 G90 G40 G01 X1.6 Y-1.25 (Move off of thread and turn off C.C.)N9 G00 Z.1 M09N10 G91 G28 Z0.N11 M30

Page 68: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

65

JUNE 2000 PROGRAMMING

HELICAL MOTION

2-12 UN 3BMinor Dia. - 1.9100/1.9198

N1 T1 M06 (12 pitch x 3/4 inch dia. 4 flt. thread hob for a 2.0-12 thread)N2 G90 G54 G00 X1.25 Y-1.25N3 S1500 M03N4 G43 H01 Z.1 M08N5 G01 Z-1.0 F50.N6 G41 X1.75 Y-1.75 D01 (position over to turn on cutter comp)N7 G03 X2.25 Y-1.25 R.5 F10. (arcing into thread)N8 G03 X2.25 Y-1.25 I-1. J0. Z-.9167 F12. (to mill complete thread)N9 G03 X1.75 Y-.75 R.5 (arcing off of thread)N10 G40 G01 X1.25 Y-1.25.(position over to turn off cutter comp)N11 G00 Z.1 M09N12 G91 G28 Z0.N13 M30

Page 69: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

66

JUNE 2000PROGRAMMING

TOOL LENGTH COMPENSATION

G43 TOOL LENGTH COMPENSATION + (plus)This code selects tool length compensation in a positive direction. That is; thetool length offsets are added to the commanded axis positions. An Hnn must beprogrammed to select the correct offset register from the offset display for thattool being used.

During the setup process, each tool point was touched-off to the part zerosurface. From this position a TOOL LENGTH DISTANCE offset was recordedfor that tool with the TOOL OFSET MESUR key. This TOOL LENGTH is referredto as the "Z" axis origin move to the part zero surface.

The programmed code to position tool: G43 H01 Z.1

TOOL CHANGER SPINDLE

CUTTING TOOL

PART SURFACE

MACHINE TABLE

G44 TOOL LENGTH COMPENSATION - (minus)This code selects tool length compensation in a negative direction. That is; the toollength offsets are subtracted from the commanded axis positions. A Hnn must beprogrammed to select the correct entry from offsets memory.

G49 CANCELS G43/G44This G code cancels tool length compensation. Putting in a H00 will also cancel toollength compensation. G28, M30, and RESET will also cancel tool length comp.

Page 70: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

67

JUNE 2000 PROGRAMMING

WORK COORDINATE SELECTION

G54-59 WORK COORDINATE OFFSET SYSTEM #1 - #6These codes select one of the six user coordinate offsets stored within the offsetsmemory. All subsequent references to axes� positions will be interpreted in the newcoordinate system. Work coordinate system offsets are entered from the Offsetsdisplay page.

G110-G129 WORK COORDINATE OFFSET SYSTEM #7-26These codes are the same as work offsets G54 to G59.

MORE WORK COORDINATE SELECTIONSNote: 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 WORK COORDINATE OFFSET SYSTEM YASNACThis code selects the G52 work coordinate system. The G52 works the same asG54 etc., except that the G52 system will be set by a G92 code as well as from theoffsets display.

G52 SET LOCAL COORDINATE WORK OFFSET SHIFT VALUE FANUCThis code sets the origin of the local (child) coordinate system to the commandlocation, relative to the current work system origin. G52 is a non-modal, no motioncode. The G52 coordinate system will stay in effect for all work systems until it iscanceled. The G52 is canceled when RESET is pressed and at the end of aprogram. It is also canceled during a program by M30, G52, X0 Y0 Z0, or by a G92command.

G52 SET LOCAL COORDINATE WORK OFFSET SHIFT VALUE HAASThis code acts the same as in the Fanuc control except that G52 is not cleared atpower-up, RESET, or when an M30 is performed. It is canceled with aG52, X0 and/or Y0 and/or Z0, or by a G92 command.

G53 NON-MODAL MACHINE POSITION COORDINATE SYSTEMThis code temporarily cancels work coordinates offset and uses the machinecoordinate system (machine zero). It is non-modal; so the next block will revert towhatever work offset command that was previously selected.

Page 71: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

68

JUNE 2000PROGRAMMING

ANOTHER WAY TO RETURN TO MACHINE ZERO,USING (G53)

G53 Non-Modal Machine Coordinate SelectionThis code temporarily ignores work coordinates offset and uses the machinecoordinate system (machine zero). This gives you a command to move to a specificlocation defined from the machine zero reference point. It is non-modal; so the nextcommand block will revert back to the work coordinate offset command, that waspreviously active.

This G53 command may be used to send the machine home for a tool change, or tosend the machine home in Y, Z axes at the end of a program, rather than using aG28. A G28 works good for sending the machine home, and most people havelearned to send it home this way. But to send it straight home with a G28, and aspecific axis, you need to also define a G91 so that it positions through theintermediate point incrementally to go straight home (see p.52). And then, you willusually need to be sure to switch back to a G90 absolute command, for your nextmove. And instead of dealing with switching in and out of absolute and incremental

you could com-mand a G53along with a Z0,Y0, and/or X0 forthe specific axisyou want to sendto machine zero.

Just be sure tocancel your toollength offset witha (G49) commandwhen you definea G53 G49 Z0 tosend Z axis to ma-chine home for atool change. MACHINE TABLE

SPINDLE

G53 G49 Z0or

G53 G49 Y0 Z0

Page 72: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

69

JUNE 2000 PROGRAMMING

CANNED CYCLES

A canned cycle is used to simplify programming of a part. Canned cycles aredefined for the most common Z-axis repetitive operation such as drilling, tapping,and boring. There are 13 canned cycles to choose from and once selected a cannedcycle is active until canceled with G80. When active, the canned cycle is executedevery time an X and/or Y-axis move is programmed. Those X Y moves are executedas RAPID commands and the Z motions are executed as FEED commands, and thecanned cycle is performed again for any X-Y coordinates that follow. The fiveoperations in a canned cycle are:

1) Positioning of the X and Y axes (and optional A axis).2) Rapid traverse to the R plane.3) The drilling, tapping, and boring for the canned cycle being used.4) Operation at bottom of hole.5) Retraction to the R plane.

The positioning of a canned cycle in the X and/or Y axes can be done in either inabsolute (G90) or incremental (G91).

Incremental (G91) motion in a canned cycle is often useful with a loop (Lnn) countwhich will repeat the canned cycle operation that many times with each incrementalX or Y move for the canned cycle.

If an L0 is in the canned cycle line, the cycle will not execute until the controlreads the next X and/or Y position location.

G98 and G99 are modal commands which change the way the canned cyclesoperate. When G98 (machine default value) is active, the Z-axis will be returned tothe initial start point at the completion of the canned cycle. When G99 is active, theZ-axis will be returned to the reference (R) plane when the canned cycle iscompleted. Changes to the G98/G99 selection can also be made after the cannedcycle is active. If changed, the new G98/G99 value will change all subsequentcanned cycle.

If a canned cycle is defined in a block without an X or Y location, there are two commonactions taken by other controls; some will execute the canned cycle at that time andsome will not. With the HAAS Mill, these two options are selectable with Setting 28.

Once a canned cycle is defined, that operation is performed at every X-Y positionsubsequently listed in a block. Some of the canned cycle numerical values can alsobe changed after the canned cycle is defined. The most important of these are theR plane value and the Z depth value, and all subsequent cycles are performed withthe new R or Z value.

Page 73: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

70

JUNE 2000PROGRAMMING

CANNED CYCLES

GCODE Z Drilling Operation Operation at the

End of HoleZ axis

Retraction Application

G73 intermittent feed in dwell (optional) rapid outhigh speed peck

drilling

G74 spindle CCW feed in spindle reverse CW feed out left hand tapping

G76 feed in dwell, spindle stop, orient, shift rapid out fine boring

G77spindle stop, shift,

rapid in, shift, feed uporient spindle, shift rapid out back boring

G81 feed in none rapid out drilling

G82 feed in dwell rapid out spot drilling

G83 intermittent feed in dwell (optional) rapid out peck drilling

cycle

G84 spindle CW feed in spindle reverse CCW feed out tapping cycle

G85 feed in none feed out boring cycle

G86 feed in spindle stop,orient rapid out boring cycle

G87 feed in spindle stop, orient manual jog out boring cycle

G88 feed in dwell, spindle stop, orient manual jog out boring cycle

G89 feed in dwell rapid out boring cycle

G80 CANNED CYCLE CANCEL

The G80 code is used to cancel a canned cycle. This G code is modal in that itdeactivates all canned cycles G73, G74, G76, G77, or G81-G89 until a new one isselected. In addition to this, a G00 or G01 code will also cancel any active cannedcycle.

Page 74: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

71

JUNE 2000 PROGRAMMING

G81 DRILL CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)R Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. Use G98 and G99 for the Z position clearance location for positioningbetween holes.

N1 T1 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H01 Z1. M08N5 G81 G99 Z-.625 R.1 F10.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 75: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

72

JUNE 2000PROGRAMMING

G82 SPOT DRILL/COUNTERBORE CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)P The dwell time at the bottom of the holeR Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. A dwell in seconds/milliseconds is caused at the bottom of each Z-depth in this cycle which is defined with P. Use G98 and G99 for theZ position clearance location for positioning between holes.

N1 T2 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H02 Z1. M08N5 G82 G99 Z-.625 P1.5 R.1 F8.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 76: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

73

JUNE 2000 PROGRAMMING

G83 DEEP HOLE PECK DRILL CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)Q The peck depth amount value, always incrementalI Optional size of first cutting depth (If Q is not used)J Optional amount to reduce cutting depth each pass (If Q is not used)K Optional minimum depth of cut (If Q is not used)P The dwell time at the bottom of the holeR Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. And the depth for each peck in this cycle will be the amount definedwith Q. Then the tool will rapid up to the R plane after each peck and then back infor the next peck until Z depth is reached. Use G98 and G99 for the Z positionclearance location for positioning between holes.

If I, J, and K are specified, a different operating mode is selected. The firstpass will cut in by I, each succeeding cut will be reduced by amount J, andthe minimum cutting depth is K.

Setting 22 specifies the distance the tool returns back to above from where it hadleft off at from the previous peck in a G83 canned cycle.

Setting 52 also changes the way G83 works when it returns to the R plane. Mostprogrammers set the R plane well above the cut to insure that the chip clear motionactually allows the chips to get out of the hole but this causes a wasted motion whenfirst drilling through this �empty� space. If Setting 52 is set to the distance requiredto clear chips, the R plane can be put much closer to the part being drilled. Whenthe clear move to R occurs, the Z will be moved above R by this setting.

Page 77: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

74

JUNE 2000PROGRAMMING

(G83 using Q)N1 T3 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H03 Z1. M08N5 G83 G99 Z-2.125 Q.5 R.1 F8.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 78: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

75

JUNE 2000 PROGRAMMING

(G83 using I, J & K)N1 T3 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H03 Z1. M08N5 G83 G99 Z-2.125 I.5 J.1 K.2 R.1 F8.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 79: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

76

JUNE 2000PROGRAMMING

CANNED CYCLE EXERCISE #1

TOOL 3 - is a 1/2 DIA. SPOT DRILL - Drill To a depth of .200 to leavea .400 dia. spot for a counterbore chamfer. (use a G81 canned cycle)

Spindle Speed - S2000 (Surface Speed is 209.)Feed Per Minute - F8.0 (Chip Load is .002)

TOOL 4 is a 1/4 DIA. DRILL - Drill thru to a 1.2 depth (use a G83 canned cycle witha .250 peck amount)

Spindle Speed - S2900 (Surface Speed is 190.)Feed Per Minute - F14.5 (Chip Load is .0025)

TOOL 5 is a 3/8 DIA. 4 FLT. END MILL - Drill to a .325 depth (use a G82 cannedcycle with a dwell for a 1/2 second)

Spindle Speed - S1750 (Surface Speed is 172.)Feed Per Minute - F10.5 (Chip Load is .0015)

Page 80: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

77

JUNE 2000 PROGRAMMING

CANNED CYCLE EXERCISE #1

O00050 (CANNED CYCLE EXERCISE #1)T__ M____ (T3 - 1/2 DIA. SPOT DRILL)G____ G____ G____ X______ Y______S_____ M____G____ H____ Z______ M____G____ G____ Z______ R____ F____X______ Y______X______ Y______X______ Y______G____ G____ Z______ M____G____ G____ Z______ M____M____ (Optional stop)

T___ M____ (T4 - 1/4 DIA. DRILL)G____ G____ G____ X______ Y______S_____ M____G____ H____ Z______ M____G____ G____ Z______ Q____ R____ F____X______ Y______X______ Y______X______ Y______G____ G____ Z______ M____G____ G____ Z______ M____M____ (Optional stop)

T___ M____ (T5 - 3/8 DIA. 4 FLT. END MILL)G____ G____ G____ X______ Y______S_____ M____G____ H____ Z______ M____G____ G____ Z______ P____ R____ F____X______ Y______X______ Y______X______ Y______G____ G____ Z______ M____G____ G____ Z______ M____M____ (Program stop)

Page 81: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

78

JUNE 2000PROGRAMMING

G84 TAPPING CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Position of bottom of holeR Rapid position of the R planeF Feed Rate in inches (mm) per minute

This G code is modal. Use G98 and G99 for the Z position clearance location.

If your using a spindle speed that's in low gear you may want to command M42 toforce it into high gear, because most tapping (a smaller size tap) operations don't needthe torque of low gear. And in high gear the tapping operation will perform quicker.

With Rigid Tapping, the ratio between feedrate and the spindle speed must becalculated for the thread pitch being cut. The calculation is 1/Threads Per Inch xrpm = tapping feedrate. Use the Haas calculator for the speed and feed numbers.

N1 T4 M06 (1/2-20 tap)N2 G90 G54 G00 X.75 Y.75N3 S800 M42 (You don't needan M03. The G84 turns on spindle)N4 G43 H04 Z1. M08N5 G84 G99 Z-.65 R.1 F40.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

You don't need to start thespindle with a M03 for a tapthat's using G84 because thiscycle will turn on the spindlefor you automatically and itwill do it quicker.

Page 82: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

79

JUNE 2000 PROGRAMMING

G85 BORE IN AND BORE OUT CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)R Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. Use G98 and G99 for the Z position clearance location for positioningbetween holes.

N1 T5 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H05 Z1. M08N5 G85 G99 Z-.55 R.1 F10.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 83: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

80

JUNE 2000PROGRAMMING

G86 BORE IN, STOP, and RAPID OUT CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)R Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. Use G98 and G99 for the Z position clearance location for positioningbetween holes.

N1 T6 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H06 Z1. M08N5 G86 G99 Z-.55 R.1 F10.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 84: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

81

JUNE 2000 PROGRAMMING

G87 BORE IN, and MANUAL RETRACT CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)R Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. Use G98 and G99 for the Z position clearance location for positioningbetween holes.

N1 T7 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H07 Z1. M08N5 G87 G99 Z-.55 R.1 F10.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 85: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

82

JUNE 2000PROGRAMMING

G88 BORE IN, DWELL and MANUAL RETRACT CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)P The dwell time at the bottom of the holeR Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. Use G98 and G99 for the Z position clearance location for positioningbetween holes.

N1 T8 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H08 Z1. M08N5 G88 G99 Z-.55 P1.5 R.1 F10.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 86: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

83

JUNE 2000 PROGRAMMING

G89 BORE IN, DWELL, BORE OUT CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)P The dwell time at the bottom of the holeR Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. A dwell in seconds.milliseconds is caused at the end of the Z-depthin this cycle which is defined with P. Use G98 and G99 for the Z position clearancelocation for positioning between holes.

N1 T9 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H09 Z1. M08N5 G89 G99 Z-.5 P1.0 R.1 F10.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 87: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

84

JUNE 2000PROGRAMMING

CANNED CYCLE EXERCISE #2

1.000

4.500

3.500

.500

.500

1.500

2.500 2.125

.875

Use the HAAS CALC Display for Spindle speed and FeedrateTOOL #1 - 90 DEG. 5/8 (.625) DIA. SPOT DRILL TO A .25 DEPTHUse G81 CANNED CYCLE S_________Surface Speed - 230. SFM Chip Load - .0025 F_________

TOOL #2 - 27/64 (.4219) DIA. DRILL THRU TO 1.2 DEPTHUse G83 CANNED CYCLE aith a Q.25 peck amount S_________Surface Speed - 230. SFM Chip Load - .003 F_________

TOOL #3 - 1/2-13 TAP WITH RIGID TAP THRU TO 1.15 DEPTHUse G84 CANNED CYCLEUse Tapping Calculator for FEEDRATE at 600 RPM F_________

Page 88: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

85

JUNE 2000 PROGRAMMING

CANNED CYCLE EXERCISE #2

O00060 (CANNED CYCLE EXERCISE #2)____________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________________

Page 89: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

86

JUNE 2000PROGRAMMING

G73 HIGH SPEED PECK DRILL CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Bottom of hole (Feed point of Z depth starting from R plane)Q The peck depth amount value, always incrementalI Optional size of first cutting depth (If Q is not used)J Optional amount to reduce cutting depth each pass (If Q is not used)K Optional minimum depth of cut (If Q is not used)P The dwell time at the bottom of the holeR Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. The depth of each peck in this cycle will be the amount defined withQ or using IJ & K or K & Q. The tool will pull back after each peck and then back infor the next peck until Z depth is reached. This cycle is a high speed peck cyclewhere the retract distance it pulls back after each peck is set by Setting 22. Use G98and G99 for the Z position clearance location for positioning between holes.

SETTING 22 specifies the distance that the tool pulls back after each peck in a G73canned cycle to break the chip.

SETTING 52 also changes the way G73 works when it returns to the R plane whenusing K and Q. When the clear move to R occurs, the Z will be moved above R bythis setting distance.

Page 90: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

87

JUNE 2000 PROGRAMMING

(G73 using Q)N1 T3 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H03 Z1. M08N5 G73 G99 Z-2.15 Q.1 R.1 F8.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

G73 HIGH SPEED PECK DRILL CANNED CYCLE USING Q

If Q is used, it specifies the amount each peck will be in a G73 canned cycle.

Page 91: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

88

JUNE 2000PROGRAMMING

G73 HIGH SPEED PECK DRILL CANNED CYCLE USING I,J,K

If I, J, and K are specified, a different operating mode is selected. The first peck willbe in by I, each succeeding peck will be reduced by the J amount, with the minimumpeck being defined with K.

(G73 using I J K)N1 T3 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H03 Z1. M08N5 G73 G99 Z-2.15 I.5 J.1 K.2 R.1 F8.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 92: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

89

JUNE 2000 PROGRAMMING

G73 HIGH SPEED PECK DRILL CANNED CYCLE USING K & Q

If K and Q are both specified, a different operating mode is selected for this cycle.In this mode, after a number of pecks of Q distance down in the part totals up to theK amount, the tool is then returned to the R plane. This allows much faster drillingthan G83 but still returns to the R plane occasionally to clear chips.

(G73 using K & Q)N1 T3 M06N2 G90 G54 G00 X.75 Y.75N3 S1200 M03N4 G43 H03 Z1. M08N5 G73 G99 Z-2.15 Q.2 K1. R.1 F8.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 93: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

90

JUNE 2000PROGRAMMING

G74 REVERSE (LEFT HANDED) TAP CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Position of bottom of holeR Rapid position of the R planeF Feed Rate in inches (mm) per minute

This G code is modal. Use G98 and G99 for the Z position clearance location.

If your using a spindle speed that's in low gear, you may want to command M42 toforce it into high gear, because most tapping (a smaller size tap) operations don'tneed the torque of low gear. And in high gear the tapping operation will performquicker.

When rigid tapping is used, the ratio between the feed rate and spindle speed mustbe precisely calculated for the thread pitch being cut.

N1 T4 M06 (1/2-20 tap)N2 G90 G54 G00 X.75 Y.75N3 S800 MO4 (You don't needan M04. G84 turns on spindle)N4 G43 H04 Z1. M08N5 G74 G99 Z-.6 R.1 F40.N6 X1.5 Y1.5N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

You don't need to start thespindle with a M04 for atap that's using G74 be-cause this cycle will turnon spindle for you auto-matically, and it will do itquicker.

Page 94: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

91

JUNE 2000 PROGRAMMING

G76 Fine Boring Canned CycleX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Position of bottom of holeP The dwell time at the bottom of the holeQ The shift value, always incrementalI Optional X-axis shift value, if Q is not specified.J Optional Y-axis shift value, if Q is not specified.R Rapid position of the R plane (Where you rapid, to start feed)F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. Use G98 and G99 for the Z position clearance location for positioningbetween holes.

N1 T6 M06N2 G90 G54 G00 X1.0 Y.75N3 S1200 M03N4 G43 H06 Z1. M08N5 G76 G99 Z-.55 P.5 Q.02 R.1 F8N6 G80 G00 Z1. M09N7 G28 G91 Z0. M05N8 M30

The Q value distance willshift in the direction set bysetting 27. If Q is not speci-fied, the optional I and Jvalues are used to deter-mine the shift direction anddistance. And a dwell at Z-depth in this cycleif a P command is defined.

Page 95: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

92

JUNE 2000PROGRAMMING

G77 BACK BORE CANNED CYCLEX Optional rapid X-axis commandY Optional rapid Y-axis commandZ Feed location depth of back Counterbored holeR Rapid position into the bore to the R planeQ The shift value, always incrementalI Optional X-axis shift value, if Q is not specified.J Optional Y-axis shift value, if Q is not specified.F Feed Rate in inches (mm) per minute

This G code is modal so that it is activated every X and/or Y axis move, and it willrapid to that position and then cause this canned cycle to be executed again, untilit's canceled. Use G98 and G99 for the Z position clearance location for positioningbetween holes.

N1 T7 M06N2 G90 G54 G00 X1.25 Y1.25N3 S1200 M03N4 G43 H07 Z1. M08N5 G77 G99 Z-.35 R-.6 Q.1 F8.N6 G80 G00 Z1. M09N7 G28 G91 Z0. M05N8 M30

This cycle will shift the X and/or Y axis prior to and after cut-ting in order to clear the toolwhile entering and exiting thepart. The Q value shift direc-tion is set with setting 27. If Q isnot specified, the optional I andJ values can be used to deter-mine shift direction and dis-tance. The tool will rapid downto the R clearance depth andfeed up to the Z command depthfor back counterbore.

The Q value distance willshift in the direction set bysetting 27. If Q is not speci-fied, the optional I and Jvalues are used to deter-mine the shift direction anddistance.

Page 96: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

93

JUNE 2000 PROGRAMMING

CANNED CYCLE AUXILIARY FUNCTIONS

G98 Canned cycle initial Point ReturnThis G code is modal and changes the way canned cycles operate. With G98, thecanned cycle will return to the initial starting point between each newX and/or Y location during the canned cycle command.

G99 Canned cycle R Plane ReturnThis G code is modal and changes the way canned cycles operate. With G99, thecanned cycle will return to the R plane between each new X and/or Y locationduring canned cycle command.

N1 M06N2 G90 G54 G00 X1.5 Y-.5 (1)N3 S1200 M03N4 G43 H01 Z1. M08 (Initial start point is Z1.0)N5 G83 G99 Z-1.2 Q.2 R.1 F8. (G99 Position to R.1 rapid point)N6 X.5 Y-.75 (2)N7 Y-2.25 (3)N8 G98 X1.5 Y-2.5 (Position to initial start point after drilling hole) (4)N9 G99 X3.5 R-.4 (Position to rapid point after drilling hole) (5)N10 X4.5 Y-2.25 (6)N11 Y-.75 (7)N12 X3.5 Y-.5 (8)N13 G80 G00 Z1. M09N14 G28 G91 Z0. M05N15 M30

8

56

7

43

122.500 2.250

.750

1.000

.500

Page 97: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

94

JUNE 2000PROGRAMMING

BOLT HOLE PATTERNS

There are three G codes that provide patterns usually used for bolt holes. These areG70, G71, and G72. These G codes must be used with one of the canned cyclesG73, G74, G76, G77, or G81-G89. To define the beginning of an angle, the start isCCW from horizontal going from 0 to 360.0 degrees starting from Three o' clock.Using a minus value reverses the direction to CW for the starting position fromThree o' clock.

G70 Bolt Hole CircleI RadiusJ Starting angle (0 to 360.0 degrees CCW from three o' clock)L Number of holes evenly spaced around the circle

The tool must be positioned at the center of the circle either in a previous block orin the G70 block. G70 belongs to Group zero and thus is non-modal. For a G70 towork 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 ArcI RadiusJ Starting angle (Degrees CCW from three O' clock)K Angular spacing of holes (+ or -)L Number of holes

This G code is similar to G70 except that it is not limited at one complete circle. G71belongs to Group zero and thus is non-modal. For a G71 to work correctly, a cannedcycle should be active so that at each of the positions, some type of drill or tap cycleis performed.

G72 Bolt Holes Along an AngleI Distance between holesJ Angle of line (Degrees CCW from three o' clock)L Number of holes

This G code drills L holes in a straight line at the specified angle. It operatessimilarly to G70 and G71. G72 belongs to Group zero and thus is non-modal. For aG72 to work correctly, a canned cycle should be active so that at each of thepositions, some type of drill or tap cycle is performed.

Page 98: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

95

JUNE 2000 PROGRAMMING

BOLT HOLE CIRCLE

You must position to the center of the bolt hole circle in the XY axis coordinates,either in the G70 command block, or define the XY coordinates in a previouscommand block.

If an L0 is on the canned cycle line, the cycle will not execute that command untilthe control reads the next line for a G70 command, so as not to drill a hole in thecenter of a bolt hole circle. Or you can combine the drill cycle with the G70 on thesame line, and it will also, not drill a hole in the center.

Be sure to use a decimal point with angle command codes.

G70 BOLT HOLE CIRCLE COMMAND I = Radius of the bolt circle J = Starting angle from three o'clock L = Number of holes (evenly spaced)

N1 T1 M06N2 G90 G54 G00 X2. Y-1.5 (Center position of bolt hole circle)N3 S1200 M03N4 G43 H01 Z1. M08N5 G81 G99 Z-.45 R.1 F8. L0 (L0 will not execute this command)N6 G70 I1.0 J0. L8 (until control reads next location.)N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 99: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

96

JUNE 2000PROGRAMMING

BOLT HOLE ARC

You must position to the center of the bolt hole arc in the XY axis coordinates, eitherin the G71 command block, or define the XY coordinates in a previous commandblock.

If an L0 is on the canned cycle line, the cycle will not execute that command untilthe control reads the next line for a G71 command, so as not to drill a hole in thecenter of a bolt hole arc. Or you can combine the drill cycle with the G71 on the sameline, and it will also not drill a hole in the center.

Be sure to use a decimal point with angle command codes.

G71 BOLT HOLE ARC COMMAND I = Radius of the bolt circle J = Starting angle from three o'clock K = Angular spacing between holes L = Number of holes (evenly spaced)

N1 T2 M06N2 G90 G54 G00 X2. Y-1.5 (Center position of bolt hole arc)N3 S1200 M03N4 G43 H02 Z1. M08N5 G81 G99 Z-.45 R.1 F8. L0 (L0 will not execute this command)N6 G71 I1.0 J15. K30. L7 (until control reads next location)N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 100: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

97

JUNE 2000 PROGRAMMING

BOLT HOLES ALONG AN ANGLE

If an L0 is on the canned cycle line, the cycle will not execute that command untilthe control reads the next line for the G72 command. Or you can combine the G72with the drill cycle on the same line.

Be sure to use a decimal point with angle command codes.

G72 BOLT HOLES ALONG AN ANGLE COMMAND I = Distance between holes J = Angle from three o'clock L = Number of holes (evenly spaced)

N1 T3 M06N2 G90 G54 G00 X.65 Y-1.5 (Start position of bolt holes along an angle)N3 S1200 M03N4 G43 H03 Z1. M08N5 G81 G99 Z-.45 R.1 G72 I.5 J20. L7 F8.N7 G80 G00 Z1. M09N8 G28 G91 Z0. M05N9 M30

Page 101: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

98

JUNE 2000PROGRAMMING

CANNED CYCLE EXERCISE #3

10°

4.000 SQ

.500

30°TYP.

45°.

1/4-20 UNF THD. x .87 DP. 5 PL.

1/4-20 UNF THD. x .50 DP. 4 PL.

1.500 DIA.

1/4-20 UNF THD. x .87 DP. 6PL.

1/4-20 UNF THD. x .87 DP.

2.00 DIA. x .50 DP. CIRCULAR POCKET 2PL.1.250

2.750

X0 Y0

1.500 DIA.

2.7502.500

1.250

.500

.500

1.000

Program a #7 (.201 Dia.) Drill at 2600 RPM at 14.5 feedrate to a Z-.95 drill tip depthfor the Bolt Hole Circle and Bolt Hole Arc and change it to a Z-.6 drill tip depth forthe Bolt Holes Along an Arc. Define the rapid plane .100 up from the bottom of thecircular pocket of the Bolt Hole Circle and Bolt Hole Arc and change the rapidplane for the Bolt Holes along an Angle back to R.1 above Z zero top of part.

NOTE: If an L0 is on the canned cycle line, the cycle will not execute that commanduntil the control reads the next location or the bolt hole command in the followingline so as not to drill a hole in the center of bolt hole circle or bolt hole arc.

Page 102: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

99

JUNE 2000 PROGRAMMING

CANNED CYCLE EXERCISE #3

O00070 (CANNED CYCLE EXERCISE #3)T6 M06 (#7 .201 DIA. CARBIDE STUB DRILL)G___ G___ G___ X_____ Y_____ (X Y center position of bolt circle)S_____ M_____G___ H___ Z_____ M___ (position to Z.1 for the initial point)G___ G___ Z_____ R_____ F___ (G81 with G98 initial point return)G___ I_____ J_____ L___ (bolt hole circle command)X_____Y_____ L___ (BOLT HOLE ARC center, but no hole here)G___ I_____ J____ K_____ L_____ (bolt hole ARC command)G___ X____ Y____ Z____ I____ J____ L___R____ (Change the R

plane for B.H.A.A.)G___ G___ Z_____ M___ (Cancel canned cycle)G___ G___ Z_____ M___M30 (End of Program)

NOTE: The circular pockets are .500 deep, so the rapid R-plane should be defined.100 above the bottom surface of pockets (R-.4) , so as not to drill air from top of partdown to bottom surface of pocket. But be careful, because the R-plane needs to bechanged back to R.1 to the rapid plane above part surface when your positioningover to drill and tap Bolt Holes Along an Angle.

Page 103: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

100

JUNE 2000PROGRAMMING

SUBROUTINES

A subprogram is a separate program called up by another program. The use ofsubprograms can significantly reduce the amount of programming on some parts.Subroutines allow the CNC programmer to define a series of commands whichmight be repeated several times in a program and, instead of repeating them manytimes, they can be �called up� when needed. A subroutine call is done with M97 orM98 and a Pnnnn. The P code command identifies the O program number beingused when executed with M98 or an N sequence number to identify the block wherea local subroutine starts when executed with M97.

Local subroutines are called with an M97. This can be easier to use than the M98because the subroutine is contained within the main program without the need todefine a separate Onnnn program. With local subroutines, you define an M30 for theend of your main program portion. And after the M30 list all of your subroutinesstarting with a N sequence number to define the beginning of a local subroutine.And then end every subroutine with an M99 to send the control back to the very nextline in the main program after the subroutine call.

This subroutine call causes the blocks in the subroutine to be executed just as ifthey were included in the main program. Then to return back to the main programyou need to end the subroutines with an M99 which sends it back to the next lineafter the subroutine call in the main program.

Another important feature of a "subroutine call" is that the M97 and M98 block mayalso include an L (loop) or repeat count. If there is an Ln with the subroutine call itis repeated that number of times before the main program continues with the nextblock.

The most common use of subroutines is in the definition of a series of holes whichmay need to be center drilled, peck drilled, tapped, and/or chamfered. If a subrou-tine is defined that consists only of the X-Y position of the holes, the main programcan define the canned cycles, and the hole locations can be called up in thesubroutine to do each of the tool operations. Thus, the X-Y positions can be enteredonly once and used several times for each tool.

Page 104: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

101

JUNE 2000 PROGRAMMING

O00080(PROGRAM CALLING SUB-PROGRAM WITH AN M98)T1 M06 (5/8 DIA. SPOT DRILL)G90 G54 G00 X0.5 Y-0.875S1406 M03G43 Z1. H01 M08G81 G99 Z-0.25 R0.1 F7. (G81 Drilling Canned Cycle)M98 P0081 (Call Sub-Program O0081)

T2 M06 (27/64 DIA. DRILL)G90 G54 G00 X0. 5 Y-0.875S2082 M03G43 Z1. H02 M08G83 G99 Z-1.2 Q0.25 R0.1 F12.5 (G83 Peck Drilling Canned Cycle)M98 P0081 (Call Sub-Program O0081)

T3 M06 (1/2-20 TAP)G90 G54 G00 X0.5 Y-0.875S750 (G84 will turn on the spindle, so no M03 is needed)G43 Z1. H03 M08G84 G99 Z-1.15 R0.1 F37.5 (G84 Tapping Canned Cycle)M98 P0081 (Call Sub-Program O0081)G28 G91 Y0.M30 (End of Main Program)

(Sub-routine)(Listing all the hole positions)O0081X1.5 Y-.5X3.5X4.5 Y-.875Y-2.125X3.5 Y-2.5X1.5X.5 Y-2.125G80 Z1.0 M09G28 G91 Z0. M05M99 (End of sub-program and

returns back to the next linein the main program afterthe M98 sub-program call.)

To return back to themain program you needto end the sub-programwi th an M99 wh ichsends it back to the nextline after the sub-pro-gram call in the mainprogram.

Page 105: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

102

JUNE 2000PROGRAMMING

O00090 (PROGRAM CALLING LOCAL SUB-ROUTINE WITH M97)T01 M06 (5/8 DIA. SPOT DRILL)G90 G54 G00 X0.5 Y-0.875S1406 M03G43 H01 Z1. M08G81 G99 Z-0.25 R0.1F7. (G81 Drilling Canned Cycle)M97 P0091 (Call Local Sub-Routine N0091)

T02 M06 (27/64 DIA. DRILL)G90 G54 G00 X0.5 Y-0.875S2802 M03G43 H02 Z1. M08G83 G99 Z-1.2 Q.25 R0.1 F12.5 (G83 Peck Drilling Canned Cycle)M97 P0091 (Call Local Sub-Routine N0091)

T03 M06 (1/2-13 TAP)G90 G54 G00 X0.5 Y-.875S750 (G84 will turn on the spindle so, M03 is not needed)G43 H03 Z1. M08G84 G99 Z-1.15 R.1 F37.5 (G84 Tapping Canned Cycle)M97 P0091 (Call Local Sub-Routine N0091)G28 G91 Y0.M30 (End of program)

N0091 (Local subroutine example listing all the hole locations)X1.5 Y0.5X3.5X4.5 Y-0.875Y-2.125X3.5 Y-2.5X1.5X0.5 Y-2.125G80 G00 Z1. M09G28 G91 Z0. M05M99 (End of local sub-routine and returns back to the next line in the mainprogram after the M97 sub routine call.

Page 106: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

103

JUNE 2000 PROGRAMMING

GENERAL PURPOSE POCKET MILLING

G150 General Purpose Pocket MillingX X position of starting hole (not needed if your already at that location)Y Y position of starting hole (not needed if your already at that location)P Subprogram call number defining the geometry of pocketI X-axis shift over cut increment (use I or J not both)J Y-axis shift over cut increment (use I or J not both)K Finishing cut allowanceG41 Cutter Comp. Left or G42 Cutter Comp. Right of programmed pathD Cutter geometry offset selection numberZ Final depth of pocketR R plane positionQ Incremental Z-axis depth down, starting from R planeF Feed rate

This G code provides for general purpose pocket milling. The shape of the pocketto be cut must be defined by a series of motions within a subroutine. A series ofmotions in either the X or Y-axis will be used to cut out the specified shape followedby a finishing pass to clean up the outer edge. Only one of either I or J must bespecified. If I is used, the pocket is cut from shifting over in the X-axis and thestrokes will be along the Y-axis. If J is used, the pocket is cut from shifting over inthe Y-axis and the strokes will be along the X-axis. I and J must be positivenumbers. The finishing pass is K and the K command must be a positive number.There is no finishing pass in the Z depth with the K.

Multiple depth of cuts on pocket can be defined to control the cut depth. The feeddown to the final Z depth starts from the R plane feeding down by the Q amount, foreach pass, until the Z depth is reached. Q must be positive. If an L count is specifiedon the G150 command line with a G91 and an X and/or Y value, the entire block isrepeated again at an incremental X or Y distance L number of times.

The subroutine must define a closed loop area by a series of G01, G02, or G03motions in X and Y axes and must end with an M99. G codes G90 and G91 can alsobe used in the subroutine to select absolute or incremental. Any codes other thanG, I, J, R, X, or Y are ignored in the subroutine. This subroutine must consist of lessthan 20 strokes.

Pocket milling may need to begin from a hole which has been previously drilled tothe Z depth, in order to plunge the tool on entry of the pocket on the G150. Youspecify this hole location with X and Y in a previous block or in the G150 commandline.

Page 107: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

104

JUNE 2000PROGRAMMING

The first motion in the SUBPROGRAM should move from this clear hole to thestarting point of the pocket geometry. The final motion in the SUBPROGRAMshould close the loop at the same point where you began the pocket geometry, ie.,in the example on the following page, the start point of the G150 line is X3.25 Y4.5and the first move of the of the sub is Y7.0. Therefore the end of the sub must returnto X3.25 Y7.0.

If K is specified, the roughing cuts will cut inside the programmed pocket size by Kamount. The finishing pass will follow along the pocket geometry edge and is doneat the full pocket depth.

O00100 (G150 POCKET MILLING EXAMPLE)N1 (Tool 1 drills a clearance hole in pocket for end mill to plunge in.)T1 M06 (1/2 DIA. DRILL)G90 G56 G00 X3.25 Y4.5 (Starting location for pocket milling routine.)S2000 M03G43 H01 Z1.0 M08G83 Z-2.0 R.1 Q0.5 F10.G80 G00 Z1.0 M09G28 G91 Z0 M05

N2 (G150 pocket milling doing four cut depths to Z depth)T2 M06 (T2 1/2 DIA. E. M.)G90 G56 G00 X3.25 Y4.5 (Starting location for pocket milling routine.)S2000 M03G43 Z1.0 H02 M08G01 Z0 F20. (Feed down to start point in Z axis for increment Q depth)G150 P101 J0.4 (or I.4) K0.02 G41 D02 Z-1. Q0.25 R.1 F12.G01 G40 X3.25 Y4.5 (Be sure to cancel cutter comp.)G00 Z.1 M09G28 G91 Y0 Z0 M05M30

(Sub-routine for the pocket geometry of the G150 pocket milling cycle is on the nextpage, which is called with P101 on the G150 line which is looking for programO00101.

Page 108: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

105

JUNE 2000 PROGRAMMING

(SUBPROGRAM)O00101 (G150 POCKET GEOMETRY)G01 Y7.X1.5G03 Y5.25 R0.875G01 Y2.25G03 Y0.5 R0.875G01 X5.G03 Y2.25 R.875G01 Y5.25G03 Y7. R0.875G01 X3.25M99 (Return to main program)

G150 NOTES1. Position to the starting point inside the pocket with end mill. Do not have cutteroverlap on any line of the pocket geometry with the entry of end mill.

2. In the G150 command line, it calls up a subprogram with a P command (P1234)which is calling up a separate program (O1234) that defines in it, the geometry ofa pocket. This pocket geometry must be defined in 20 moves or less.

3. You can also define an island within the pocket, but remember, you only have 20moves to define your G150 pocket command.

(G150 notes continued)

Page 109: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

106

JUNE 2000PROGRAMMING

MORE G150 NOTES4. This pocket geometry "cannot" be after the M30 of a program like the way an M97is used. It must be in a separate program, which is called up by a G150 with the Pcommand the defines that program number which contains the pocket geometry.

5. When you're defining the pocket geometry in the subprogram. You define it fromthe starting point that is a location somewhere inside pocket. And then you definea move onto the side of the pocket and around pocket geometry. Close the loop atwhere you began defining the pocket, end the subprogram there with an M99. Don'ttry to move back to the starting point where you began.

6. Define the path of the "pocket geometry" in the direction that you wish to cut withyour end mill. Define the pocket path clockwise to conventional cut using G42, orcounter clockwise to climb cut using G41. And this path will be reversed if youposition onto an island inside the pocket to either climb cut or conventional cutwith the end mill.

7. When you position onto and off of an island inside a pocket, and you're usingcutter compensation (G41 or G42), you will either be left or right of the line, theamount of the cutter compensation in your offset register. And if you position ontothe island on the same line or location value as you position off the island, than youwill leave a large scallop the size of the radius of your cutter offset. So to elimi-nate this scallop condition you need to overlap your entry and exit moves onto andoff of the island. You need to overlap these entry and exit moves at least the radiusamount, of the cutter comp offset being used. Overlapping a little more than theradius amount of the cutter offset being used is usually preferred.

8. The Q value must be defined in a G150 even if your only doing one pass to theZ final depth. And the Q amount is defined from the R plane. So if you only want onepass, and your final depth is Z-.25 and your starting the pocket at R.1 above the part.Than your Q value down will be Q.35 for doing one pass to the final depth.Otherwise if you give it a Q.25 the first depth would be calculated from .1 down theamount of Q.25 which would be at a Z-.15 into the pocket, for a first pass and thenit would take another pass at the final depth of Z-.25 for a second pass.

9 .If you should execute a G150 pocket milling command in a program and you havean invalid move in your subprogram geometry, the control will alarm out on theG150 command line in the main program. But the error is somewhere within thesubprogram, and you need to some how locate the error in the subprogram. Thento locate this error, run the subprogram separately in graphics to locate this error inthe subprogram geometry. Being able to run this subprogram in graphics you needto enter a feedrate command at the beginning of the sub-program. Now you will beable to troubleshoot subprogram in graphics. After your done fixing the moves inyour subprogram, take the feedrate command back out of subprogram. And verifythe fix in graphics of the G150 command, in the main program.

Page 110: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

107

JUNE 2000 PROGRAMMING

Page 111: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

108

JUNE 2000PROGRAMMING

FINAL EXERCISE

TOOL #1 - 1.00 dia. 4 flt. End Mill - finish mill contour at a .3 depth,1 pass. 250 FPM - .003 chip per tooth S_________ F________

TOOL #2 - 1 3/4 dia. Insert Drill - rough drill circular pocket to .480depth using a G81 canned cycle. 250 FPM - .005 chip per tooth

S_________ F________

TOOL #3 - 5/8 dia. 4 flt End Mill - finish 1.800 dia. x .5 depth circularpocket. 250 FPM -.0025 chip per tooth. S_________ F________

TOOL #4 - 1/2 dia. Spot Drill - drill 6 holes .2 depth using G82 cannedcycle. 200 FPM - .0035 chip per tooth S_________ F________

TOOL #5 - 5/16 dia. Drill - drill 6 holes thru using G73 canned cycle200 FPM - .003 chip per tooth S_________ F________

TOOL #6 - 3/8-16 Tap - tap 6 holes thru using G84 with a machine thathas rigid tapping. Tap at 600 RPM, S_________ F________

Page 112: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

109

JUNE 2000 PROGRAMMING

FINALEXERCISE

Be sure to position thecutter to the center of thetool at least half the cutterdiameter off of the part sur-face before activating cut-ter comp.

TOOL #1 - 1.00 dia.4 flt. End Mill.Climb cut a finish passaround contour shape thatis .3 depth 1 pass usingcutter comp.250. FPM x .003 chip pertooth.

O01010 (FINAL EXERCISE)T___ M___ (1.00 DIA. END MILL)G___ G___ G___ X______ Y______S____ M___G___ H___ Z____ M___G___ Z____ F30. (Non-cutting fast feed to depth)G___ Y_____ D___ F___ (Turn on Cutter Comp.)X_____G___ X______ Y______ R______G___ Y______X_____ Y_____X_____X_____ Y_____Y_____G___ X______ Y______ R______G___ G___ X_____ Y_____ (Cancel Cutter Comp.)G___ Z_____M___G___ G___ Z____ M___

Be sure to position theEnd Mill at least half thecutter diameter off the partsurface, before cancelingcutter comp.Cancel to thecenter of tool.

Page 113: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

110

JUNE 2000PROGRAMMING

FINAL EXERCISE

TOOL #2 - 1 3/4 Dia. 2 fluteInsert Drill.Rough the 1.800 circular pocket.480 depth using G81 canned cycle.250 FPM x .005 chip per tooth

T___ M___ (1 3\4 DIA. INSERT DRILL)G___ G___ G___ X_____ Y_____S_____ M_____G___ H___ Z_____ M___G___ Z_____ R____ F___G___ G___ Z_____ M___G___ G___ Z_____ M___

Page 114: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

111

JUNE 2000 PROGRAMMING

FINAL EXERCISE

TOOL #3 - 5/8 dia. 4 flt. End MillMill a 1.800 dia. pocket to a .500depth using G13 for a circularpocket milling routine.250 FPM x .0025 chip per tooth

T___ M___ (5\8 DIA. 4 FLT. END MILL)G___ G___ G___ X_____ Y_____S_____ M_____G___ H___ Z_____ M___G___ Z_____ F____ (Plunge Z axis down in part at a feedrate)G___ I_____ K_____ Q_____ Z_____ D___ F___G___ Z_____ M___G___ G___ Z_____ M___

Page 115: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

112

JUNE 2000PROGRAMMING

FINAL EXERCISE

The rapid plane for the drill and tap is R-.2 down from the top surface of part.

TOOL #4 - 1/2 dia. Spot DrillUse a G82 to spot drill for 6 holes to a depth of -.4 with a rapid planeof -.2 and a 1/2 second dwell at bottom.200 FPM x .004 chip per tooth.

TOOL #5 - 5/16 dia. DrillUse a G73 to drill 6 holes thru part to a depth of -.75 with a .1 peck depth amountand a -.2 rapid plane.200 FPM x .003 chip per tooth.

TOOL #6 is a 3/8-16 TapUse a G84 to tap 6 holes thru part to a -.7 depth and a -.2 rapid plane,with a 600 RPM.Machine is equiped with rigid tapping.

(first hole) (second hole)

(third hole)

(fifth hole) (fourth hole)

(sixth hole)

Page 116: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

113

JUNE 2000 PROGRAMMING

FINAL EXERCISE

T___ M___ (1\2 DIA. SPOT DRILL)G___ G___ G___ X______ Y______S_____ M_____G___ H___ Z_____ M___G___ G___ Z_____ P____ R____ F___M___ P____

T___ M___ (5\16 DIA. DRILL)G___ G___ G___ X______ Y______S_____ M_____G___ H___ Z_____ M___G___ G___ Z_____ Q____ R____ F___M___ P___

T___ M___ (3\8-16 TAP)G___ G___ G___ X______ Y______S_____ (M03 not needed with G84)G___ H___ Z_____ M___G___ G___ Z_____ R____ F___M___ P___G53 Y0T1 M06 (Change to tool #1 for the next part to be run)M___ (End of program)

(SUB-PROGRAM)O01011G___ X_______G___ Y_______G___ X______ Y_____G___ X______X______Y______G___ G___ Z____ M___G___ G___ Z____ M___M___

Use G98 and G99 forthe Z position clearancelocation for positioningbetween holes.

G98 Initial Point ReturnG99 R Plane Return

Page 117: PROGRAMMING WORKBOOK - Penn State · PDF filePROGRAMMING WORKBOOK HAAS AUTOMATION, INC ... computer and is programmed with a machine code system that ... give a basic understanding

114

JUNE 2000PROGRAMMING