Haas TM-1P Vertical CNC Machining Center
Haas TM-1P Vertical CNC Machining Center
Haas TM-1P Vertical CNC Machining Center
The CNC (Computerized Numerical Control) mill from Haas in the MIME Manufacturing Processes Lab, uses G
& M codes to tell the computer on the milling machine what to do. While all CNC machines use G & M codes
that are very similar, each control or machine manufacture will sometimes have some of the G or M codes
doing something a little different than another manufacture.
We are going to give you some of the more common G codes and explain how they work, and then we will
show you a complete G-Code program that will run on the MIME Haas mill.
Common “G” Codes:
G00 Move to position in a rapid motion.
G01 Linear motion at programmed feed rate. Usually in inches per minute.
G02 Circular Interpolation in the Clockwise motion. For radius moves clockwise to the right of the cutter.
G03 Circular Interpolation in the Counter Clockwise motion. Radius to the left of the cutter.
G12 Circular Pocket Milling Clockwise.
G13 Circular Pocket Milling Counter Clockwise.
G17 XY Plane.
G20 Select Inches.
G21 Select Metric.
G40 Cutter Radius Cancel.
G41 Cutter Radius Left. Moves the radius of the cutter to the Left of the desired cutter path.
G42 Cutter Radius Right. Moves the radius of the cutter to the Right of the desired cutter path.
G43 Tool Length Compensation. This must be followed by the tool number doing the cutting.
G47 Text Engraving.
G52 – G59 These are the work offset Coordinate registers. XYZ coordinates of the workpiece on the table.
G80 Canned Cycle Cancel.
G81 Drill Canned Cycle.
G83 Peck Drilling Canned Cycle.
G150 General Purpose Pocket Milling.
These are just a few of the many “G” Codes available to the Haas controller. We will explain some of
them and show you how to use them in a program.
M00 Program Stop. Used mid-program to shut everything down for some kind of part or tool service work,
example, clearing chips. To re-start push the Cycle Start key again and the program will continue.
M03 Spindle Start Clockwise direction.
M04 Spindle start Counter Clockwise.
M06 Tool change. This command is followed by a tool number. Example, M06 T05, tool change to #5.
M08 Turns the coolant on.
M09 Coolant Off.
M30 Program ends, reset back to line one in the program.
% Used on the first and last lines of a program.
; End of a block signifier. Not end of the line, rather the end of a command block that may rap around to
the next line.
Programming a Peck Drilling Operation
This is the part print that we used for our CNC program. The complete G-Code program is below and each
command is explained line by line.
The X0. Y0. & Z0. Work Offset for this program was set to the upper left hand corner of the workpiece. I have
randomly chose this location. Keep in mind that all X moves will be in the positive direction and Y & Z moves
are going to be negative. To make things a bit simpler I could have chosen to set the work offset to the bottom
left corner of the part. If the lower left corner was used for the work offset then all X&Y moves would have
been positive. The Z moves are still negative.
To insert comments in your program you enclose the comments inside the parentheses (Comments here).
In the program below, the blue comments to the right on each line are there to explain what each G or M code
does. The blue comments are not normally used when writing programs.
%
O00205 (MP CNC DRILLING); Part Program location. Letter “O” followed by five numbers.
(T5 .25 DRILL T10 .125DRILL); Inside of the brackets are notes to the operator and
ignored by the control. You can have as many as needed to help with tool selection,
part placement, tooling needed and more.
(4*4*.625 WOOD WORKPIECE); Operator comments.
(G57 WORK OFFSET); Operator comments.
M06 T5 (.25 DRILL); M06-Tool Change, T5 insert tool #5 in the spindle.
M03 S1500 ; M03-Spindle on Clockwise rotation and at 1,500 RPM.
G57 G00 G90 G17; G57-Work Offset, G00-Rapid Traverse, G90-Absolute Positioning, G17-
XY Plane.
X0 Y0 ; This is the home position of the workpiece called out by the G57 command. Not
the machine home.
G43 H05 Z0.25; G43-Tool Length Compensation, H05-Z length value for tool #5, Z0.25-¼”
above the workpiece.
G01 F10.; G01-Linear Interpolation Motion, F10.-Feed rate in inches per minute.
G01 X0.625 Y-0.625; G01-Move at the programmed feed rate to the new X&Y location.
G83 Q0.1 P1. R0.2 Z-1.; G83-Peck Drilling Canned cycle, Q0.1-Peck Depth(always
incremental), P1.-Pause(Dwell) at the end of the last peck for one second to break
the chips, R0.2-Retract to this distance above the part before moving to the next
hole location, Z-1. Total depth of the drilled hole.
X3.375; Next hole location.
X3.125 Y-3.125; Third hole location.
X0.625; Fourth and final ¼” diameter hole location.
G80 G00 Z2.; G80-Cancel canned cycle and Rapid the Z to 2” above the part.
S200; New Spindle RPM.
X-1. Y1.; Move Cutter to this new XY Location.
M06 T10; M06-tool change to tool number 10.
M03 S2000; M03-Spingle on Clockwise at 2000 RPM.
G57 G00 ;G57-Work Offset, G00 Rapid Motion Positioning.
X1. Y-2.; Rapid to this XY location.
G43 H10 Z0.25; G43-Tool Length Compensation for tool number 10, Z position above the
workpiece.
F10.; Feed rate.
G83 Q0.1 P1. R0.2 Z-1.; Peck Drilling Canned Cycle. (See G83 above)
X3.; Second 1/8” hole location.
G80 G00 Z1.; G80-Cancel Canned Cycle, move the Z to 1” above the workpiece.
S200; New Spindle RPM.
M06 T5; Tool Change to T5 the ¼” Drill.
M30; End of program, reset to line one in the program.
Haas Manufacturing has many great YouTube videos called “Haas Tip of the Day” videos.
Each explaining time saving shortcuts and instructions specific to their machines.
Check them out at https://www.haascnc.com/video.html
On the Haas website they have a video called “9 Lines of Code Every CNC Machinist
Needs to Know!” This is a great starting point to programming the Haas machines.
Next week’s project you will be asked to write the Haas CNC Mill “G” code for a new
blue print.