CNCCookbook: Be a Better CNC'er

Want to be a better CNC'er?

Get our weekly newsletter plus a package of greatest hits, special tips, and more, all for free.

I'm Ready to Be a Better CNC'er, Hook Me Up!

 

G28: Return to Reference Point

CNCCookbook's G-Code Tutorial

 

What does G28 Return to Reference Point Do?

G28 is one of those odd g-codes that you don't use very often, but when you need it, it's pretty darned handy. It's function is to return to the machine's reference position, sometimes called the zero position. That zero return position is where most progams begin, most machines will go to this position when you manually home or reference the machine, and it is the reference or zero position for calculating fixture offsets for mills and geometry offsets for lathes.

Typically, G28 allows the movement to be done via an intermediate position. The movement to the reference position is done at rapids (G0) speed,and the intermediate position is used to ensure there are no collisions along the way. On many machines, if you have Single Block on, you push the Cycle Start twice--once to go to the intermediate position and once to finish at the reference position.

Specifying the G28 Intermediate Position on Mills

The intermediate position is specified using one or more position words (X, Y, or Z) after the G28. If the machine is in absolute mode, those position coordinates are relative to program zero (part zero). In relative mode, the coordinates are relative to the tool's current position. Let's try some examples:

Move Straight to the Reference Position

     G91 G28 X0 Y0 Z0

In this case, we're telling the machine the incremental position is at 0, 0, 0 relative to the tool's position. Since it thinks it is already at the intermediate position, this version essentially causes the intermediate position to be ignored and we get coordinated motion straight to the reference position.

Move straight a distance, then on to the Reference position

     G91 G28 X0 Y0 Z4.0

This variation is telling G28 that the intermediate position is 4" above the current tool position, hence the machine moves up 4" before heading straight from there to the reference position. This is much less likely to hit some errant fixture or part of the workpiece than just commanding a move straight to the reference position.

Beware absolute mode!

You'll notice the examples started with a G91 to put the machine in relative mode. In absolute mode, the intermediate point is relative to part zero. It's really hard to know a safe intermediate point in absolute mode, whereas it's pretty easy to use the relative mode with X0 Y0 Zn to make a safe move to an intermediate position that's straight up from the current tool position.

G28 on Lathes

Same idea, but we have a little different coordinate system to work with on a turning center or CNC lathe.

Let's assume we will use U and W to represent incremental moves. Then

     G28 W0

is the analog of G91 G28 Z0 on a mill. Hence, the tool moves in X only (since the incremental Z move is 0), and that's the intermediate point. It follows that up with the remaining motion in Z.

It's even more important for most turning operations to be aware of the intermediate point as collisions with the turret or gang tooling are easy to come by if you're not watchful.

G28 in Mach3

The discussion of G28 up until now has centered on the way Fanuc controls operate. Here's how it works:

G28 X~ Y~ Z~

X, Y, and Z determine an intermediate position that will be interpreted as though a G0 X~ Y~ Z~ appeared before a G28 without the XYZ. This is the same as Fanuc.

G30 is the same as G28

G28.1: Home the Axes

Issuing a G28.1 just does what happens when you manually use "Ref All" to home all the axes of your machine.

 

Exercises

1. Get out the programming manual for your machine and see how G28 is supposed to operate.

2. Write some practice code using G28 and execute it on your machine. Set up so part zero is well up in the air so there's no real chance of collision.

 

Try the Free Trial Version of G-Wizard G-Code Editor...

 

No credit card required--just your name and email.

 

Next Article: Tool Compensation: The Poor Man's CAM

 

 

 

CNCCookbook's G-Code Course

 

Featured Articles

Step-By-Step Guide to Making CNC Parts

CNC Router Cutter Types

Why Use a Single Flute Endmill?

Step and Servo Motor Sizing

The Truth About Tool Deflection

10 TIps for Router Aluminum Cutting

2 Tools for Calculating Cut Depth and Stepover

CNC Machine Hourly Rate Calculator

Special Purpose CNC Calculators

Feeds and Speeds Guide

CNC Cutter Guide

Feeds and Speeds By Material

G-Code Tutorial

  Feed Rate Calculator

Sales, and Special Deals

 

GCode is complicated.
G-Wizard Editor
makes it easy.

Try It!

 

Feeds and Speeds:
Made Easy.

Try G-Wizard

 

 

Do you want to be a better CNC'er in 37 Seconds?

Get Better Tool Life, Surface Finish, and Material Removal Rates Fast.

It's that easy. You can install and get results in a matter of minutes.

 

Start Now, It's Free!