CNC | G50 or G92 Codes | Datum Shift

In this article, we explain how to use Datum Shift function on CNC machines with G92 (Milling) or G50 (Turning) CNC G codes.

0
807

Datum Shift Introduction

The majority of CNC programs will be programs for a single job – a job that is relative to a specific machine available in the shop. Such a particular job will have its unique characteristics, its special requirements as well as its own toolpath. Tool path is the most important of all features of a typical CNC program.

It is the CNC programmer’s main responsibility to develop a functional toolpath for any given job, without errors and in the most efficient way. Tool path development is very important, because it represents a machining pattern unique to the job at hand. In most programming jobs, this machining pattern is executed for the given job only and is irrelevant to any other CNC program. Often, programmers encounter opportunities, where an existing machining pattern can be used for many new jobs. This discovery will encourage development of all programs more efficiently and produce CNC programs for many  additional applications and without errors.

Programming method that addresses this issue is known as Translation of a Machining Pattern or,more commonly, a Datum Shift. The most typical example of this method is a temporary change of program reference point (program zero) from the original position to a new position, so called work shift.

This article describes in detail the advanced subject of Datum Shift, also known as Machining Pattern Translation. This is a basic feature of all CNC systems that can be applied in a variety of ways.

G50 or G92 Datum Shift

G92 : Position register command (used in milling)
G50 : Position register command (used in turning)

In essence, datum shift is a temporary or permanent relocation of the part zero (program reference point) inside of active program.When this programming method is used, it relocates an existing machining pattern (toolpath) in the program at different locations within the CNC machine work area.

You may be interested also:
“CNC Milling | G15 and G16 Codes | Polar Coordinate System”

In particular, recall that these commands do not cause any direct tool motion, but they do influence any tool motion that follows it. Also keep in mind that the position register command G92 and G50 registers the absolute coordinates of the current tool position and have no influence whatsoever on incremental dimensions, when using the G91 command for milling or U/W axes for turning. Its normal purpose is to ‘tell’ the control system the current tool position. This step is necessary at least once at the beginning of each tool to establish the relationship between the fixed program zero (part origin) and the actual position of the cutting tool. For example;

G92 X10.0 Y6.5 ;

is ‘telling’ the control system that the cutting tool is set at positive 10.0 units away from program zero in the X-axis and positive 6.5 units away in the Y-axis.

What happens if a wrong position is registered? What if the preset values in G92 or G50 statement do not accurately reflect the true, the physical position of a cutting tool? As may be expected, the toolpath will occur at the wrong place and the result is quite likely a scrap of the machined part, tool breakage, even a damage to the machine itself. Certainly not a desirable situation.

A imaginative CNC programmer always tries to find ways and special methods that take advantage of the available programming tools. G92 and G50 commands are only two of many tools that offer a tremendous power to a creative CNC programmer. Although still available, they are considered obsolete for practical purposes.

For simple jobs, there is no need for special or creative manipulations. It is not very economical to invest precious time on adding features to the program that will never provide real advantages. If such a need is well justified, the program can be optimized later.

Program Zero Shift

If the G92 command is used on machining centers or the G50 command for lathes at all, rather than the more current and very efficient G54 to G59 work offsets, only one G92 (G50) position register command is needed for a single tool – assuming that work offsets are not used.

Any occurrence of more than a single position register command per each tool in one program is called a program zero shift.

To illustrate the concept of program zero shift, a simple but relevant drawing will be used. This drawing is illustrated in Figure 40-1.

Figure 40-1
A sample drawing for zero shift illustration – program O4001

Based on this drawing, the four holes will be machined at two independent locations of the machine table setup, as illustrated in Figure 40-2.

Figure 40-2
Program zero shift using G92 command for two parts – O4001

G92 X(A) indicates the X distance from part zero of Part A to machine zero, G92 Y(A) indicates the Y distance from part zero of Part A to machine zero. Note that the distances are from program zero to machine zero. They could terminate anywhere else if necessary, but must start from part zero. In order to use G92, the distances between both parts must be known. Simple values are used to simplify the example:

Part A: G92 X22.7 Y19.5 Z12.5
Part B: X-11.2 Y-9.7 Z0 from Part A

Also note that the Z value is the same for both Part A and Part B, because the same tool is used for both parts. To spot drill the four holes at two locations, part program may be written this way – program O4001:

O4001
(G92 USED FOR TWO TABLE LOCATIONS)
N1 G20 G90
N2 G92 X22.7 Y19.5 Z12.5(TOOL AT MACHINE ZERO)
N3 S1200 M03
N4 M08
N5 G99 G82 X2.5 Y1.5 R0.1 Z-0.2 P200 F8.0
N6 X6.75
N7 Y5.0
N8 X2.5 (TOOL AT LAST HOLE OF PART A)
N9 G80 Z1.0
N10 G92 X-8.7 Y-4.7 (SET AT LAST HOLE OF A)
N11 G99 G81 X2.5 Y1.5 R0.1 Z-0.2 P200
N12 X6.75
N13 Y5.0
N14 X2.5 (TOOL AT LAST HOLE OF PART B)
N15 G80 Z1.0
N16 G92 X-9.0 Y-4.8 (TOOL FROM MACHINE ZERO)
N17 G00 Z12.5 M09
N18 X0 Y0 (TOOL AT MACHINE ZERO)
N19 M30
%

Several blocks require clarification, namely blocks N2, N8, N10, N14, N16 and N18. Each of them relates to the current tool position in someway. Be very careful here. Not understanding the principles behind G92 calculations have caused programmers many troubles in the past.

Cutting tool starts from the machine zero position for each program execution. It is also mounted in the spindle before machining. In block N2, the part zero (reference point) for Part A is established. Cutting tool at this point is 22.7 inches from program zero along the X-axis, and 19.5 inches along theY-axis. The coordinate setting in block N2 reflects this fact. In blocks N7 and N8, the tool has completed the last hole of Part A (at X2.5Y5.0) of the current G92 setting.

The next critical block is N10. At this point in the program, Part A is completed, but Part B has not yet been started. Think a little now and see where exactly the tool is after executing block N9. It is at the position of X2.5Y5.0 of Part A. If the tool has to move to the first hole of Part B, which is also the position of X2.5Y1.5, the program has to ‘tell’ the control where the tool is at that exact moment – but in relation to Part B! That is done by a simple arithmetic calculation:

G92 (X) = 11.5 + 2.5 – 22.7 = -8.7
G92 (Y) = 9.8 + 5.0 – 19.5 = -4.7

Evaluate Figure 40-3 to visualize the calculation. Direction of arrows in the illustration is important for determining the axis sign in the G92 block.

Blocks N13 and N14 contain coordinates for the last tool location of Part B. From the illustration, it should be easy to understand meaning of the coordinate values in block N16. In order to complete the program, the cutting tool has to return to the home position (machine zero). This return

Figure 40-3
Calculations of G92 coordinates (XY) for program example O4001

will take place from X2.5Y5.0 of the Part B, which is 9.0 inches from machine zero along the X-axis and 4.8 inches along the Y-axis:

G92 (X) = 11.2 + 2.5 – 22.7 = -9.0
G92 (Y) = 9.7 + 5.0 – 19.5 = -4.8

Both programmed coordinates X and Y will be negative.

Once the current tool position is set at the last hole of Part B, return to machine zero can be made. This return is necessary, because it is the location of the first tool. The target position for machine zero is X0 Y0 not because it is a machine zero, but because the G92 coordinates were measured from there! The actual X and Y motion to machine zero is programmed in block N18.


Need to More?

Our volunteers have worked together and carefully prepared the articles published here in their native language without using machine translation. You can search the entire site for more information on the subject. You can start a discussion on CNCarea.com forums and join us to get support, ask questions, improve a published article or give your opinion.


Previous articleMitsubishi CNC | M70-M80 Series | Axis Reference
Next articleCNC Milling | G50 and G51 Codes | Scaling Function