Understanding G27, G28, G29 and G30
Take a closer look at these reference position commands.
Share
Hwacheon Machinery America, Inc.
Featured Content
View MoreECi Software Solutions, Inc.
Featured Content
View MoreA few months ago I compared using the return to reference (zero return) position (G28) to the motion relative to the machine coordinate system command (G53). I received a few questions regarding other commands related to a machine’s reference position, and I’d like to explain them here.
In order to understand G27, G29 and G30, you must have a firm understanding of G28. This return to reference position is a two-step command. Indeed, if the single block switch is turned on, you must press the cycle start button twice to fully execute a G28 command.
For any axis letter addresses included in the G28 command, the machine first will move (at rapid) to an intermediate position in those axes. Then, it will rapid to the zero return position in the commanded axes. Consider this G28 command:
G91 G28 X1.0 Y2.0 Z1.5
First, the machine will simultaneously move 1.0 (plus) in X, 2.0 (plus) in Y and 1.5 (plus) in Z. This is the intermediate position. Next, all three axes will simultaneously move to the zero return position. A special light—the axis origin light—will be illuminated as each axis reaches the zero return position.
Since most programmers want the machine to go straight to the zero return position, they give this command:
G91 G28 X0 Y0 Z0
Now the intermediate position is nothing in each axis from the current position (incremental motion of zero in each axis), so the machine stays put during the first step of G28. In the second step, all three axes will simultaneously move to the zero return position for each axis.
G27 – Reference position (zero) return check
This command tests whether a positioning movement ends at the zero return position. Consider this command:
G27 G00 X9.5373
If the positioning movement ends with the X axis at its zero return position, the X axis origin light will be lit and the machine will continue. If not, an alarm will be sounded.
I don’t see much need for this command any more. Prior to fixture offsets on machining centers and geometry offsets on turning centers, G92 and G50 were used to assign program zero. With old machines made prior to about 1982, the machine had to be in its planned position in each axis before the cycle could be activated. Many programmers chose the zero return position as the planned starting point.
It was also often important to confirm that a positioning movement truly ended at the zero return position. Consider these commands:
G50 X8.3765 Z10.3776 (Assign program zero; machine is at zero return position)
T0101 (Index to station one, invoke offset one)
(Machine with this tool)
G00 G27 X8.3765 Z10.3776 T0100 (Move to turret index position)
In this example, G27 is being used to confirm that the machine truly ended up at the same position that it started (X and Z values match G50 command and tool offset was canceled).
G29 – Return from reference position
G29 is also a two-step command. First, it causes the machine to move (in the axes commanded) to the intermediate position used in the most recent G28 command. Second, it causes the machine to move to the position included in the G29 command. Consider this command:
G90 G29 X1.0 Y1.0
The machine will first simultaneously move in X and Y to the intermediate position of the most recent G28 command. Then it will simultaneously move to X1.0 and Y1.0 (relative to program zero).
While this could be helpful when you must avoid some kind of obstruction, you must be very careful when using G29. If the intermediate position changes from tool to tool, and if tools are run out of sequence (as is often necessary when rerunning tools), a tool may not move to its expected intermediate position. For this reason, I recommend programming any obstruction-clearing motions with basic positioning commands (G00, G01, etc.), and avoiding G29.
G30 – Return to second reference position
G30 is an optional feature and may not be included on your machines. It works much like G28, except the ending position is now definable through parameter settings. G30 is often used when a machine tool builder must define a special position in each axis, such as with pallet changers on machining centers. The zero return position may not make a good pallet-change position, so the builder may incorporate a second reference position for X and Y. Then, a G30 command is given when a pallet change is required:
G91 G30 X0 Y0
G30 is programmed just like G28. First, the machine moves to an intermediate position (zero from the current position in X and Y, in our case). Second, the machine rapids simultaneously in X and Y to the second reference position.
Again, the physical location for the second reference position is set in parameters, so if you should ever need to incorporate a special reference position, you will be able to do so with G30.
Related Content
Can Connecting ERP to Machine Tool Monitoring Address the Workforce Challenge?
It can if RFID tags are added. Here is how this startup sees a local Internet of Things aiding CNC machine shops.
Read More4 Commonly Misapplied CNC Features
Misapplication of these important CNC features will result in wasted time, wasted or duplicated effort and/or wasted material.
Read MoreContinuous Improvement and New Functionality Are the Name of the Game
Mastercam 2025 incorporates big advancements and small — all based on customer feedback and the company’s commitment to keeping its signature product best in class.
Read MoreFrom Tradition to Transformation: Century-Old Manual Machine Shop Adds CNCs
After 122 years of working with manual mills and lathes, this fifth-generation shop acquired assets of a local CNC machining business and hired the owner. Here’s how it’s going a year later.
Read MoreRead Next
Registration Now Open for the Precision Machining Technology Show (PMTS) 2025
The precision machining industry’s premier event returns to Cleveland, OH, April 1-3.
Read MoreBuilding Out a Foundation for Student Machinists
Autodesk and Haas have teamed up to produce an introductory course for students that covers the basics of CAD, CAM and CNC while providing them with a portfolio part.
Read More5 Rules of Thumb for Buying CNC Machine Tools
Use these tips to carefully plan your machine tool purchases and to avoid regretting your decision later.
Read More