G91 & G90 G-Code: CNC Absolute and Incremental Programming

Is Manual Machining Faster than CNC for Simple Parts?

G91 & G90 G-Code: CNC Absolute and Incremental Programming

What’s the Difference Between Absolute and Incremental Coordinate System?

Let’s start with a definition. Absolute coordinates are measured from program zero, the program’s origin. Relative moves are measured from the current position. We just looked at Circular Arc moves using G02 and G03. The coordinates of the arc center as expressed by I and J are relative coordinates.

Now, a more practical example. Suppose you’re in a grocery store and you ask the clerk which aisle the cookies are on. If he responds, “Go to Aisle 14 for the cookies,” that’s an absolute coordinate that is relative to the first aisle–the grocery store’s “part zero”.

If instead he responds, “It’s three aisles down that way,” that’s an incremental coordinate. We’re used to both kinds in everyday life and both are useful depending on the situation.

Mr Whipple: Grocery Clerk

Note that what we might call “relative coordinates” are often called “incremental mode” coordinates in the CNC Controller Programming manuals. It’s just another way of saying the same thing.

Switching between Relative and Absolute Coordinates

How can we switch between Relative and Absolute Coordinates? The usual way is to use G90 to use Absolute Coordinates and G91 to use Relative Coordinates. For example:

G90 ( Switch to absolute coordinates )

G0 X0Y0Z0 ( Move to program origin at 0, 0, 0 )

G91 ( Switch to relative coordinates )

G0 X1Y1 ( Move one unit right in X and one unit right in Y )

G90 ( Switch back to absolute coordinates )

The preceeding program includes both an absolute move to X0Y0Z0 and a relative move. As you can see, G90 and G91 are modal.

Which Mode Does My Controller Use as the Default?

Interestingly, most controls will startup in relative/incremental mode (G91). This is done because it is thought to be safer if the mode is not what you expect. In other words, if you expected absolute it is thought to be safer to start in incremental than if you expected incremental and start in absolute. The truth is, not being in the mode you expect is not safe any way you look at it because the machine will do something unexpected. Therefore, make sure one of the first things you do in your program is to set it to either G90 or G91 so it does what you expect!

Using UVW Words for Incremental Coordinates

Some controllers allow both styles to be active at once using UVW. We could write the previous program this way:

G90 ( Switch to absolute coordinates )

G0 X0Y0Z0 ( Move to program origin at 0, 0, 0 )

G0 U1V1 ( Move one unit right in X and one unit right in Y )

This UVW format is convenient and a little shorter. We’ve already mentioned controllers where I and J are relative which is a similar case to UVW, albeit intended for arc center location.

Why Would I Use Incremental vs Absolute Moves?

Let’s consider a couple of cases.

First, its all about how you want to think about your problem. Is it more natural to think about what’s going on relative to some absolute central point or relative to your current location? The CNC controller doesn’t care, so do what’s easy for you.

Second, suppose you’re just reading off a print and keying in the g-code. It may be easier to use the relative coordinates for some points as you may not have an absolute coordinate readily available. Prints usually provide dimensions relative to adjacent features rather than relative to some absolute part zero origin.

A last example, is when writing subprograms. Suppose you have a feature that is repeated more than once in your g-code program. Perhaps you drill a hole, chamfer it, and then thread it with a tap, for example. These holes are located all over a plate you’re machining. The easy way to program such a think is to create a subprogram (we’ll be talking about subprograms in detail a little later, but for now, use your imagination) that assumes it is located above the center of the hole and can just proceed to do all the work using relative coordinates. Now you can just make an absolute move and then call the subprogram for each hole and only have to write the code once. What a time saver.

Exercises

1. Write a g-code program that feeds the cutter around a 1 inch by 1 inch rectangle whose center is at 1, 1. Use absolute coordinates.

2. Convert the program you wrote in #1 to use relative coordinates. You may use an absolute coordinate to get to the center of the rectangle in an initial G00 move.

3. Determine whether your control allows UVW moves, and if so, rewrite #2 to use them without calling G91 to switch to relative coordinates.

Next Article: Polar Coordinates

 

Software that will make anyone a better CNC'er

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!

G91 & G90 G-Code: CNC Absolute and Incremental Programming
5 (100%) 1 vote

Home

Software

  GW Calculator

  GW Editor

  Thread Calculator

  Gearotic

  Conversational

CNC Programming / GCode

  Free Training

  G-Code Simulator

  G-Code / M-Code List

 

Feeds & Speeds

     Calculator

     Free Calculator   

     

CNC Machining & Manufacturing

 

Resources

     CNC Dictionary

     Hall of Fame

     Free Calculators

 

About

     Customers

     Partners

     Our History

     Privacy Policy

 
All material © 2018, CNCCookbook, Inc.