Centroid CNC control sales, service, training and support
These codes allow you to change the effective part zero and/or machine zero positions on the fly. They can be handy in certain situations, but they can also trip you up.
If you are going to use them, it is especially important to understand how they interact with the Centroid control's Search and Resume features.
The Run/Search option allows you to start any program at any given line number, block (N) number, or tool (T) number. At present (early 2008) it only searches in the main program -- not in subprograms -- and it finds only the first occurence of a given block number or tool number.
The Run/Resume option is only available when the last job run was interrupted before completion. It allows you to restart that job on the move it was doing when it was interrupted. It is a little more powerful than Search, in that it keeps track of subprogram calls and repeats so that it can resume even in a subprogram. It also breaks down some multi-move operations, so that a lengthy G83 drilling cycle on a mill, or G71 stock removal cycle on a lathe, can resume in the middle of the cycle rather than having to start over.
Both Search and Resume work by processing the entire G code file from the beginning. Resume works from stored information about the line number, program file, repeat count, move count and so on, but it does not store any G code modal information. Instead, both Search and Resume get their modal information by processing all the G codes in the job until they get to the search point.
To understand it best, think of the control asking "If we start the job from the beginning, right here and right now, where will we be and what will we be doing when we get to the search point?".
Picturing that, you can see immediately that a job that consists entirely of G91 incremental-mode moves cannot be successfully Resumed unless you first jog the machine back to where it was when you originally started it.
Similarly, changes made to your zero location with G92, G52 and M26 may have unexpected side effects in the Search and Resume process.
On a Mill control, G92 resets the part zero position based on current tool position.
On a Lathe control, G50 with absolute coordinates (Z and X) does the same thing. The remainder of this discussion uses Mill codes as examples, but the same principles apply to Lathe.
The most common use is to rapid the tool to some X and Y location,
then do a
G92 X0 Y0 to make that position be the new
part zero. Then you can cut a feature (perhaps one in a subprogram file)
based on that "local" part zero. Most programs that do this will later
move back to a known XY location and do another G92 to restore the
original part zero. There is no way to "cancel" a G92; you can only
"undo" it through a reverse of the original operation. For example:
N10 G0 X0 Y0 ; go to the original part zero N20 M98 P1234 ; run some subprogram there to cut a feature N30 G0 X5 Y2 ; go to a new location, 5" and 2" away from original zero N40 G92 X0 Y0 ; make part zero be here N50 M98 P1234 ; run the subprogram again to cut another feature N60 G0 X0 Y0 ; move back to the *new* part zero N70 G92 X5 Y2 ; restore the original part zero
Note that the N60-N70 lines could just as well have been written:
N60 G0 X-5 Y-2 ; move back to the original part zero, relative to the new one N70 G92 X0 Y0 ; restore the original part zero
If you cancel the above job during blocks N50 or N60, then the part zero will have been changed and will not be restored. If you then restart the job, it will cut in the wrong place.
Even if you use the Resume feature to resume the job where it was interrupted, it will still cut in the wrong place. Remember how Search and Resume work, with the question: "If we start the job from the beginning, right here and right now, where will we be and what will we be doing when we get to the search point?".
If we started the job from the beginning, it would run N10 and N20 to cut the first feature, based on the current part zero. But that part zero was moved 5" and 2" in the cycle we just interrupted, so the first feature would cut in the second location. Then the control would do the move and G92 on N30 and N40, introducing another 5" and 2" shift. By the time it got to the resume point, it would have twice the intended coordinate shift in effect.
If you must use G92 this way, and you find you need to resume an interrupted job, you should go back to Part Setup and reset your original part zero location before you use Run/Resume.
Another common use of G92 is to zero a rotary axis at the beginning of
a cycle. If you are running 4-axis milling jobs on round stock, then
you might insert
G92 B0 or something similar at the
beginning of the program. You don't care where the rotary axis was
before, you just want it to be zero wherever you start the cycle.
If you do that, then you should be sure to move the rotary axis back to zero, or to some multiple of 360, before using Search or Resume to restart an interrupted job.
The G50 code on a Lathe control can be specified with incremental incremental coordinates (U and W). In this mode it will move the part zero location incrementally by the specified amounts. Because the change to part zero is incremental, it does not matter where the axes are positioned when the G50 U_ W_ code is given.
You can "undo" an incremental G50 with a later incremental G50, negating
the shift amounts. For example, a
G50 U-0.5 W1.5 could
be undone by a subsequent
G50 U0.5 W-1.5. Note that
G50 U0 W0 never does anything.
In all other regards, G50 on the lathe works like G92 on the mill: it permanently changes the part zero location. Do not mistake an incremental G50 for the mill's G52 code discussed below.
G52 works much like G92, but is more forgiving. It sets a specified
incremental shift to be added to the part zero location. A subsequent
G52 command replaces the earlier one, rather than adding on to it.
You can, therefore, cancel G52 altogether with
G52 X0 Y0.
There is no Lathe code equivalent to the Mill's G52.
The program above could have been written:
N10 G52 X0 Y0 ; cancel any previous shift N20 G0 X0 Y0 ; go to the original part zero N30 M98 P1234 ; run some subprogram there to cut a feature N40 G52 X5 Y2 ; add a shift of 5" and 2" to the part zero N50 M98 P1234 ; run the subprogram again to cut another feature N60 G52 X0 Y0 ; cancel the shift, restoring the original part zero
Because G52 just specifies a shift amount to be added to the part zero location, it does not matter where we are positioned when we use it.
Any time we use G52 in a program, we should have a
G52 X0 Y0
G52 X0 Y0 Z0) at the beginning of the program to ensure
that the shift starts out in a known place. This way our program runs
the same even if it was previously interrupted while G52 was active.
M26 resets machine zero on an axis whereever that axis happens to sit. Since part zero is recorded internally as a distance relative to machine zero, moving machine zero will move part zero as well.
As a rule, part programs should not contain M26. The machine's homing macro will use M26, usually after the appropriate M91 or M92 home-to-switch operation, to set a repeatable machine zero position on power up. Thereafter you should leave machine zero alone.
An exception is for rotary axes on a mill control. If you run jobs with continuous rotation (e.g. a rotisserie-style prosthetics carver) then you need a way to "reset" the axis back to zero turns in between parts, so the control won't want to unwind all those turns to get from the end point of one job back to the start point of the next.
In that case it is reasonable to put M26, possibly combined with G92, at the end or start of the rotary job. See my rotary fourth axis tutorial for more information.
CNC Services Northwest Home
Copyright © 2008 Marc Leonard
Last updated 09-Mar-2008 MBL