Quick Guide to the G90 CNC G Code [Tips and Tricks]

a graphic of a cnc machine with text that says learn g code today G90 absolute positioning mode

Code

G90

Name

Absolute Positioning

Type


Modal - stays on until changed

Description

The machine will read all locations as relative to a fixed zero location

A G90 code sets the CNC to absolute positioning mode. This means that the CNC will interpret all location values as relative to a single zero location.

That single zero location is usually the workpiece zero location (set by a work offset such as G54) or the CNC machine zero location (home position).

G90 vs G91: CNC positioning modes

For a CNC machine there are two positioning modes available. They are absolute (G90) and incremental (G91) positioning.

As noted above, absolute positioning with G90 will take all locations relative to a fixed zero location.

With incremental positioning (G91), the machine will interpret all locations as relative to the current location. In other words, once the machine moves to a new location, that location becomes the new zero.

Both codes are modal which means that the code will stay active until it is either canceled or changed. For G90 and G91, there is no cancel code so the only way to change them is to call the opposite code.

graph paper example of absolute positioning with multiple points as examples
graph paper example of incremental positioning with multiple points as examples

The images above show the difference between the absolute and incremental positioning modes. The numbers in parentheses are the locations given to the the machine to make the move.

Notice how in absolute mode, all locations are relative to a single location, usually either the workpiece zero or machine home location. 

In incremental mode, all locations are relative to the machine’s current location.

When to use a G90 code

G90 codes are used frequently. This is because they get used as part of safety lines of code sometimes called safety block.

Safety lines are a chunk of code that is used to ensure that the machine is in the correct modes before executing a section of the CNC program.

They are used at the start of new sections of code such as when changing tools.

The main portion of most programs will be in absolute mode. Incremental mode is usually only used to create repetitive features such as drilling a set of holes.

Why using a G90 code is important

Both G90 and G91 are modal commands which means that they will stay in effect until changed or canceled.

It is important to set your positioning mode in your program with either G90 (absolute mode) or G91 (incremental mode).

Imagine if you had an operation where you were going to drill a set of holes. Before you drill those holes, it would be wise to set all the necessary modes you will need to have active.

Setting the positioning mode (absolute or incremental), setting the type of units you are in (inches or mm) and turning on various compensation modes are just some of the modes that you might want to have set.

If these modes are already active, then nothing will change. No harm, no foul.

If they weren’t active and you didn’t turn them on, you might crash your machine.

When writing your CNC programs, it is critical to be in the correct positioning mode at all times. For this reason, a G90 or G91 code should be used at the start of a new section of the program.

What to think about when using a G90 code

Know where you are at and where you want to move the machine.

In other words, you need to know where the start and stop location of each move is.

The main body of most programs will be written in absolute mode. This is because it is easier to visualize a part based on absolute coordinates.

G90 code example

N0010 G90 F100 S1200 T01

N0020 G00 X36 Y10

N0030 Z2

N0040 G01 Z-12 M03

N0050 X36

N0060 Z2 M05

N0070 M30

Line N0010 sets the positioning mode as absolute. It also sets the feed rate to 100, spindle speed to 1200 and selects tool 01.

Line N0020 sets the movement mode as rapid travel. It then moves to the XY location listed.
Line N0030 rapid moves to the Z location.

Line N0040 sets the movement mode to straight line movement, turns the spindle on clockwise and feeds to the z location at the feed rate listed in line N0010.

Line N0050 moves to the listed X location in a straight line at the previous feed rate.

Line N0060 moves to the listed Z location and turns the spindle off.

Line N0070 ends the program.

CNC codes that are similar to G90

We already discussed the most common code that is similar to G90. G91 sets the machine in incremental positioning mode.

The other main codes that affect positioning are G60 and G64.

G60 sets the CNC to single direction positioning mode.

The G60 code will make force the machine to approach each new location from the same direction. This decreases location errors that can occur because of backlash in the machine.

G64 is normal positioning mode. In normal positioning mode, the machine will move all axes at the same time and will approach the workpiece form whichever side is fastest.

Want to learn more about G Code for your CNC?

Leave a Comment