Gcode G28, G30, and G10 (G54-59?) Commands

I am seeking the collective knowledge of the group. I have two places I have regularly been using as a material zero point, and would like to set these as ‘presets’ to move to after homing the machine. I use a touch plate for setting Z for each bit/cut, so I really only care about preset X and Y.

My basic understanding of some advanced G Code functions is that I can setup multiple Zero reference points. I read a fantastic writeup of how the G28 command works posted by @PatrickRainsberry.
Please correct me if I am wrong, but it looks like G30 can be used as a similar, secondary reference point. I also read something about using G54 through G59 as a reference point.

What is the difference between G28 and G30, and G54-G59? More importantly, how do you set these, and what advantages/disadvantages are there for using G28 versus G54? I found a line of
G10 L20 P1 X0 Y0 Z0;
that sets the position P1 to G54. Px can change (P1…P6) and corresponds to setting values at G54 through G59.

Many thanks in advance.


To set the point for G28 jog your machine to the location that you want to save and then issue a G28.1 to save the position. Later to return to that position you issue the G28 command (UGCS uses G28 for the “Return to Zero” button).

Same for G30 and G30.1

G28 and G30 use the Machine Space co-ordinates.

G10 L20 P1 X0 Y0 Z0 sets the co-ordinates for G54 co-ordinate system’s origin at the current position of the spindle (UGCS uses this command for the “Reset Zero” button).

G28.1 and G30.1 set the current spindle location as their save point.

Since G54 - G59 work on specifying a co-ordinate system you need to know how G-code uses co-ordinate systems. I haven’t used them so it would take some investigation to see how they work.

G28 and G30 are very straightforward.

1 Like

Thanks @LarryM! I think I am getting the hang of it.

If I home the machine with my homing switches, I can use G28 and G30 as quick travel locations. It does not seem to matter where I have set my material Zero points at, the spindle will move to the machine position programmed for G28.

I have now set G28 up to bring my spindle forward so I can make bit changes easier. Moving back to X0 Y0 Z0 will take me to wherever I have set my material Zero.

After some reading and playing around. G54-G59 are “Work Coordinate Register” values. In my brain, I think of them as ‘workspaces.’ G54 is one milling area’s Zero point, G55 being another, and so on through G59. You could use these points to make multiple copies of the same thing. Draw the part once, cut it out 2 (or 6!) times in different places of the material. You can select which ‘workspace’ you want to use by entering G54, G55, and so on through G59.

G54 seems to be the default ‘workspace.’ I changed to G55 and then power cycled the machine, and it reverted back to G54’s work coordinates (I also noticed it defaulted back to G21, or metric units, but that’s a story for another day).

The “Reset Zero” button in UGS sends “G10 P0 L20 X0 Y0 Z0”. This will reset XYZ for whatever G54-59 ‘workspace’ you currently have active. If you want to set coordinates for a different ‘workspace’, you need to change P0 to P1…P6.
P1 = G54
P2 = G55
P3 = G56
P4 = G57
P5 = G58
P6 = G59
I have no idea what the “L20” portion of the Gcode is for, but it doesn’t seem to work without it.

To change your ‘workspace,’ pick one from G54-G59.
To check the stored coordinates of the ‘workspaces,’ enter $#
To see which workspace is active (and a bunch of other helpful info), enter $G

I have set G54 as the lower left corner of my X-Carve, with the Z height pretty close to the top so I don’t crash into anything. G55 is set farther in, where I have been regularly placing smaller parts so they are easier to clamp down.

I use G92 as a Z offset when I use the touch probe. How G92 fits into all of this is also something I would like to figure out.



Here is what I have been able to find for the “L” parameter:
Its generic name is Loop Counter, but is used differently for the G10 command.

G10 use: Specification of what register to edit (work offsets, tool radius offsets, tool length offsets, etc.).

1 Like

i’m in the process of researching this, so i’ll add this find here regarding the L parameter
from http://www.practicalmachinist.com/vb/cnc-machining/understanding-g10-255375/

"L tells the control what to modify. Whether it be work coordinate, tool length, tool diameter, tool wear offset length, tool wear offset diameter, measured work coordinate or tool life. I’m sure there may be others on different controls. The L values may differ between controls, refer to your specific programming manuals.

Example - for a Brother B00 control (Fanuc compatible for the most part)
L2 = work offset input or modification (G90/G91 dependent)
L10 = tool length input or modification (G90/G91 dependent)
L12 = tool diameter input or modification (G90/G91 dependent)
L11 = tool wear length input or modification (G90/G91 dependent)
L13 = tool wear diameter input or modification (G90/G91 dependent)
L99 = automatic measurement adoption (after G121/G129)
L97 = tool life setting "

1 Like

The info here is very interesting and useful. But are these commands recognized by the X-Carve controller? There is a list of G code that can be used with the X Carve controller, and some of these aren’t in that list.

My question is: Using commands for this machine, how do I set the X Y home, and then set the Z home separately?

1 Like

These are the various GRBL Settings that you can use to home and set the position of the z axis after homing. You type $$ into the console window to bring them up. To get to the console window in Easel, you go to Machine/advanced/ machine inspector. To change a setting you type $=" whatever is you want to change the number to" and hit enter. $H initiates the homing cycle. If you are using UGS, there is a button with this on it.

Grbl v1.1 Configuration · gnea/grbl Wiki · GitHub

GRBL_Settings_Pocket_Guide_Rev_B.pdf (diymachining.com)