What's new
What's new

G28 Reference Point Return (Programming)

WakelessFoil

Aluminum
Joined
Aug 18, 2020
I am trying to edit our F360 post processor to output G-code files for our Fanuc 3M equipped milling machine. Near the beginning of each program I would like the machine to perform a reference point return followed by setting my work shift offset. We did this on a recent lathe project and the code looked something like this:

G28 U0.
G28 W0.
G50 X~.~ Z~.~ (SET OFFSET FOR FOLLOWING PROGRAM)


I believe the standard Fanuc post processor attempts to mimic this same procedure on the milling machine, be it in a different form for the machine:

G28 G91 Z0.
G90
G92 X~.~ Y~.~ Z~.~


I am not really sure why fusion only specifies Z in that first block. When I test this code in MDI it does return home but only after making a pit stop at where ever the work origin is. On the lathe, I liked the idea that you could execute this code and return the tool home to the RP from wherever regardless of the offset setting. The programming manual gives the following example, but results are not different from running previous example blocks:

G28 Z0.

I could shift the origin back to the RP but that seems a bit messy and I figure there must be a more ideal way to perform this operation.

Thanks,
Justin
 
I am trying to edit our F360 post processor to output G-code files for our Fanuc 3M equipped milling machine. Near the beginning of each program I would like the machine to perform a reference point return followed by setting my work shift offset. We did this on a recent lathe project and the code looked something like this:

G28 U0.
G28 W0.
G50 X~.~ Z~.~ (SET OFFSET FOR FOLLOWING PROGRAM)


I believe the standard Fanuc post processor attempts to mimic this same procedure on the milling machine, be it in a different form for the machine:

G28 G91 Z0.
G90
G92 X~.~ Y~.~ Z~.~


I am not really sure why fusion only specifies Z in that first block. When I test this code in MDI it does return home but only after making a pit stop at where ever the work origin is. On the lathe, I liked the idea that you could execute this code and return the tool home to the RP from wherever regardless of the offset setting. The programming manual gives the following example, but results are not different from running previous example blocks:

G28 Z0.

I could shift the origin back to the RP but that seems a bit messy and I figure there must be a more ideal way to perform this operation.

Thanks,
Justin
Hello Justin,
G28 is a two shot G Code, that moves the specified Axis Slide to it's Reference Return position, via an intermediate point. In Absolute Mode (G90) the following command would move the tool to Z Zero on the work-piece and then to the Reference Return Position. In Single Block Mode, two presses of the Cycle Start Button would be required to complete this one command execution. The first press of the button would take the tool to Z Zero and the second press to the Reference Return Position.

G90 G28 Z0.0

In Incremental Mode (G91) the following command will also move the specified Axis to the Reference Return Position via an Intermediate Point, but that points is the same as the current position. Accordingly, when not running in Single Block Mode, it appears as though the Axis has moved directly to the Reverence Return Position in one move. However, this command in Single Block Mode will still take two presses of the Cycle Start Button to complete the command.

G91 G28 Z0.0

Your machine will most likely have a Second Reference Return Command, G30. Setting the position for the G30 Reference Return is quite simple, by specifying in a respective parameter, the Incremental Distance from the Machine Reference Return Position, where you want the G30 Reference Return position to be. With the Lathe operation that involved the Tailstock that you were having trouble with, A G30 position for Z could be set so that the Z Reference Return Position was at a location forward of the Tailstock where the turret can be indexed safely. The syntax for the use of G30 is the same as for G28.

Regards,

Bill
 
Hello Justin,
G28 is a two shot G Code, that moves the specified Axis Slide to it's Reference Return position, via an intermediate point. In Absolute Mode (G90) the following command would move the tool to Z Zero on the work-piece and then to the Reference Return Position. In Single Block Mode, two presses of the Cycle Start Button would be required to complete this one command execution. The first press of the button would take the tool to Z Zero and the second press to the Reference Return Position.

G90 G28 Z0.0

In Incremental Mode (G91) the following command will also move the specified Axis to the Reference Return Position via an Intermediate Point, but that points is the same as the current position. Accordingly, when not running in Single Block Mode, it appears as though the Axis has moved directly to the Reverence Return Position in one move. However, this command in Single Block Mode will still take two presses of the Cycle Start Button to complete the command.

G91 G28 Z0.0

Your machine will most likely have a Second Reference Return Command, G30. Setting the position for the G30 Reference Return is quite simple, by specifying in a respective parameter, the Incremental Distance from the Machine Reference Return Position, where you want the G30 Reference Return position to be. With the Lathe operation that involved the Tailstock that you were having trouble with, A G30 position for Z could be set so that the Z Reference Return Position was at a location forward of the Tailstock where the turret can be indexed safely. The syntax for the use of G30 is the same as for G28.

Regards,

Bill
So by using G30, I can specify my RP position in a parameter and when G30 is executed it will return directly to that point?

Even in incremental mode the tool goes through the intermediate point (work zero) for some reason. Shouldn't running G28 in incremental (G91) send the tool straight to reference point?

The 3M manual doesn't specify G30 but does have G27, G28, and G29 labeled under automatic reference point return.

Programming manual excerpt: https://drive.google.com/file/d/1z7l7CYiepkg82jkXgBroMdZLDVchEYUC/view?usp=sharing

Thanks,
Justin
 
…….
Even in incremental mode the tool goes through the intermediate point (work zero) for some reason. Shouldn't running G28 in incremental (G91) send the tool straight to reference point?

Is this in MDI or a program? IIRC, on a 3 series, the selection of absolute or incremental in MDI was done by setting, not G90/G91. Those only were effective in a program.
 
Even in incremental mode the tool goes through the intermediate point (work zero) for some reason. Shouldn't running G28 in incremental (G91) send the tool straight to reference point?

The 3M manual doesn't specify G30 but does have G27, G28, and G29 labeled under automatic reference point return.
Hello Justin,
At least with the 3M Model O control, G30 is a Basic feature. You could test it by selecting a slow Rapid Speed, or Dry Run, and executing the following command:

G91 G30 Z0.0

If a p/s010 alarm is raised, then your machine is without G30, if not, then you should be good to go.

I'm surprised if the sequence of G91 within the Command Block would prevent the G28 command from working as expected in Incremental Mode, but the syntax of G91 at the start of the Block is common.

Regards,

Bill
 
Last edited:
Is this in MDI or a program? IIRC, on a 3 series, the selection of absolute or incremental in MDI was done by setting, not G90/G91. Those only were effective in a program.
This was in MDI. I will try running this code in auto mode to observe any difference.
You could test it by selecting a slow Rapid Speed, or Dry Run, and executing the following command:

G91 G30 Z0.0
I will see how the control responds to a G30 once we get it back together. Currently chasing a brightness issue with the CRT display.
 
I got it to run properly now. The issue was that the G91 was doing nothing in MDI mode. Ran as expected in AUTO.

G28 G91 X0 Y0 Z0;

Now I just need to modify my post to home all 3 axis instead of just the Z.
 
I am trying to edit our F360 post processor to output G-code files for our Fanuc 3M equipped milling machine. Near the beginning of each program I would like the machine to perform a reference point return followed by setting my work shift offset. We did this on a recent lathe project and the code looked something like this:

G28 U0.
G28 W0.
G50 X~.~ Z~.~ (SET OFFSET FOR FOLLOWING PROGRAM)


I believe the standard Fanuc post processor attempts to mimic this same procedure on the milling machine, be it in a different form for the machine:

G28 G91 Z0.
G90
G92 X~.~ Y~.~ Z~.~


I am not really sure why fusion only specifies Z in that first block. When I test this code in MDI it does return home but only after making a pit stop at where ever the work origin is. On the lathe, I liked the idea that you could execute this code and return the tool home to the RP from wherever regardless of the offset setting. The programming manual gives the following example, but results are not different from running previous example blocks:

G28 Z0.

I could shift the origin back to the RP but that seems a bit messy and I figure there must be a more ideal way to perform this operation.

Thanks,
Justin
I program a FANUC lathe all the time.
This is how I like to structure the program
%
00200
G21
T0000 (cancel all tools and offset)
G28 Z0
G28 X0
G90
T0101
G92 Z 193.510 (position parameter set for absolute zero. The front of workpiece)
G0 X30 Z1
No need to set X axis. As X is zero anyway. As long as tools are set correctly in tool table. Machine will home and then using the G92 to find Zero set to the work piece. Hope this helps.
 
Wow, accidentally bumped onto this tread, was wondering shy sometimes g28 z0 go straight up, but sometimes it goes down and then up(ofcource crashing into wor/vise)
 
Wow, accidentally bumped onto this tread, was wondering shy sometimes g28 z0 go straight up, but sometimes it goes down and then up(ofcource crashing into wor/vise)
G28 is a two-shot command, in that it returns the specified axis to the Reference Return position via an intermediate location. To show the two-shot feature of this command, if G28 is executed in Single Block Mode, although specified within one Block, two presses of the Cycle Start Button is required for the execution to be completed.

With many Fanuc Lathe Control models, there are three different G Code Systems available, A, B and C; with System A being considered the default. With System A, Incremental Mode is specified by addresses U and W for the respective Absolute addresses X and Z. In Systems B and C, G90 and G91 are used to specify Absolute and Incremental Modes respectively.

Because G28 is Return to the Reference Return Position via an intermediate coordinate, its important that the command be executed in the correct mode in terms of Incremental or Absolute. In Incremental Mode, if G28 Z0 were to be executed, the incremental distance specified by Z Zero is Zero. Accordingly, when G28 Z0 is executed, the axis would first move to the intermediate position Zero distance away from the current location and then from there, directly to the Z Reference Return position. When in Single Block Mode, the press of the Cycle Start Button seems to have no affect other than to illuminate the Feed Hold Light. A second press of the Cycle Start Button will have the G28 command complete and the Z axis will move directly to the Reference Return Position. When not in Single Block Mode, it appears as thought the G28 Z0 command moves the Z axis to the Reference Return Position in one move.

If the same G28 Z0 command is executed in Absolute Mode and the tool is at, say, Z20.0 (mm), the Z Axis will first move to Z Zero (Work Coordinate System Z Zero) and from there, directly to the Z Reference Return Position. If the Tool happened to be over the work-piece (probable) and there was material between the Tool and Z Zero, then the tool will crash into the work-piece.

The example posted by Andy 000000000 is not such a good example for new chums to be following as its not specific to all machines in general and specifically to all Fanuc Controls. His control will be set to use either G Code System B or C, as he has specified G90 in the program. His example shows the Work Coordinate System being set with G92 and how the machine performs with the Coordinate System set this way is parameter dependent. Given that he hasn't specified Incremental Mode before executing the G28 Command, following his example with a G28 Z0 command in Absolute Mode is risky business.​


Regards,

Bill
 
Last edited:
Mine controls is Yasnac, that are based on Fanuc-Om series in terms of operation logic. So if I enter G91. G28Z300 then machine would go 300mm from up from active WCS and then to home pos? Am i getting this correctly?
 
Incremental Mode ignores the Work Coordinate System and moves an incremental distance from the current position. In your example, the Z axis would move 300mm in the Z+ direction, then to the Z Reference Return Position. There is no need to have a value other than Zero when in Incremental Mode to have the specified Axis move to its Reference Return Position.

Given your question in your previous post, having a +Z value that is clear of the top surface of the work-piece, will save crashing the Tool into the work should you inadvertently forget to specify Incremental Mode. With either Incremental or Absolute Mode, your example Z300.0 value will have the Z axis move away from the Z Zero of the Work-piece.

Regards,

Bill
 
Incremental Mode ignores the Work Coordinate System and moves an incremental distance from the current position. In your example, the Z axis would move 300mm in the Z+ direction, then to the Z Reference Return Position. There is no need to have a value other than Zero when in Incremental Mode to have the specified Axis move to its Reference Return Position.

Given your question in your previous post, having a +Z value that is clear of the top surface of the work-piece, will save crashing the Tool into the work should you inadvertently forget to specify Incremental Mode. With either Incremental or Absolute Mode, your example Z300.0 value will have the Z axis move away from the Z Zero of the Work-piece.

Regards,

Bill
You made my day. thank you

Learning every day
 
So incremental or abs cords are either needed or not depending on the control ..
And G28 either is or is not using abs cords depending on the control and one of 3 modes in the controller.

And inc mode ignores the wcs cord system - on this control, at least.
Great ! -- makes this all easy and clear !

Like always, one needs to check and test for any new gcodes.
But the fact that std gcodes are poorly documented and with little examples is pathetic, imo.

I wrote better code and docs 30 years ago.

It´s not that they implemented it one way or another, it´s that they dont communicate with examples what one can or could do depending on machine state.
 
And G28 either is or is not using abs cords depending on the control and one of 3 modes in the controller. And inc mode ignores the wcs cord system - on this control, at least.

What is the 3rd mode? It's either Incremental or Absolute.
Simply stated and that is spelt out in most manuals, G28 is a Return to Reference Return Position via an Intermediate coordinate. If in Incremental Mode and the Incremental coordinate is Zero, then the specified axis goes to that coordinate Zero distance away (no move) and then directly to the Reference Return Position.

Incremental Mode ignores the WCS in all controls; its an incremental move from the current location, so the WCS is irrelevant.


Regards,

Bill
 
Last edited:
I got it to run properly now. The issue was that the G91 was doing nothing in MDI mode. Ran as expected in AUTO.

G28 G91 X0 Y0 Z0;

Now I just need to modify my post to home all 3 axis instead of just the Z.
Homing all three axii at the same time can get you in trouble, on our machines that will rapid to machine 0,0,0 in a straight line. If you have a fixture, vise stop, clamp, etc that sit up you run the risk of crashing into it depending on where you are. It’s worse if the machine doesn’t do dog-leg rapids as it sometimes means the z doesn’t raise as fast and is more likely to crash into something. I was always taught to move z first then x &y.
 
That is correct.
G91;
G28 Z0;
G28 X0 Y0;
Recommended on a milling machine.

On a lathe,
G28 U0;
G28 W0;
is recommended.

The same route should be followed while bringing the tool near the workpiece, from home position.
 








 
Back
Top