What does a G90 code do?
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).
Learn CNC Programming – It’s Easier Than You Think!
Learning G Code doesn’t have to be difficult…
If you know what to focus on.
Join our simple, easy-to-follow course, “G Code Made Easy: CNC Programming for Beginners“. We walk you through all the important codes – with simple explanations and real-world examples.
Want to become a super-skilled CNC programmer? Join now to take the shortcut to becoming a G Code Master today!Make Learning G Code Easy
G90 vs G91: CNC positioning modes
CNC machines have two positioning modes available.
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.
G90 and G91 code are both modal.
Modal commands stay active until it is either canceled or changed.
For G90 and G91, there is no cancel code. The only way to change them is to call the opposite code.
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 a 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 or starting a new machining operation.
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.
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 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.