Programming, Positioning Mode
There are two basic methods of entering new positions into a CNC program, Absolute and Incremental (sometimes called Relative).
The mode is controlled with two G codes, G90 and G91
G90 sets Absolute mode and is usually the default.
G91 sets Incremental.
G90 and G91 are group modal.
The mode will be active until the next G90 or G91 is programmed.
In Absolute mode all positions entered are relative to the current Datum or Zero Point.
In Incremental mode all positions are relative to the last point programmed.
The above profile in Absolute
N-- Start of Program
N100 G0 X-320 Y-40
N110 Z10
N120 G1 G42 X-300 Y-60 Z0 F2000
N130 Y-250
N140 X-20
N150 Y-70
N160 X-310
N170 G40 G0 X-330 Y-50 Z10
N-- End of Program
The above profile in Incremental
N-- Start of Program
N100 G0 X-320 Y-40
N110 Z10
N120 G91
N130 G1 G42 X20 Y-20 Z-10 F2000
N140 Y-190
N150 X280
N160 Y180
N170 X-290
N180 G40 G0 X-20 Y20 Z10
N190 G90
N-- End of Program
If all the values in between the G91 and G90 are added up then the results will be the difference between the start and end points, this can be useful for checking the code particularly on complex shapes.
X | Y | Z |
20 | -20 | -10 |
-190 | ||
280 | ||
180 | ||
-290 | ||
-20 | 20 | 10 |
-10 | -10 | 0 |
The end position is X-10 and Y-10 relative to the start position, with the Z axis where it started this is correct. If the position was not where we expected then it would highlight an error in either a sign used on a value or a value itself.
When programming it is up to the programmer which positioning method is used. Both methods can be used in the same program for different portions of the code.
The descision can be influenced by several factors, here are some.