Вы находитесь на странице: 1из 9

Lesson Eleven: Inch / Metric Selection G20 & G21

Inch / Metric Selection G20 & G20


Most current CNC machines allow input in either the inch mode or the metric mode.
Generally speaking, once either input is selected, it is maintained throughout the
program. That is, seldom will you be required to use both modes in one program. In
fact, most companies will use one of these measurement modes for all programs written.
If the company comes across a part that happens to have been in the other measurement
system, they will simply convert the prints dimensions and tolerances to the
measurement system with which they are most familiar and run the workpiece in that
mode. Here are the conversion formulae.
Inches = millimeters divided by 25.4
Millimeters = inches times 25.4
For example, say you have a dimension of 16 mm on the print, but you are going to write
your program in the inch mode. To convert to inch, simply divide 16 by 25.4 to come up
with the inch equivalent (0.6299 in).
Though the metric mode is becoming more popular, the inch mode is still, by far, the
more common mode used in the United States. Since our country has been working in
the inch mode for two centuries, it has been difficult for us to make the switch to metric.
Keep in mind that switching to the metric mode involves more than simply writing
programs in metric. There are other considerations when making a switch from one
mode to the other that will cost your company money. First, all measuring devices like
micrometers, calipers, height gages, and dial indicators must be replaced when switching
to the metric mode since most of these tools are designed to show measured dimensions
in only one of the two input modes. Second, most manual machines like engine lathes,
turret lathes, and milling machines have their hand-wheel scale increments in inch.
While most machine tool builders offer replacement scales capable of converting the
machine from inch to metric, many companies find this expense to be prohibitive. Third,
all shop people must be re-educated to work in metric. For these reasons, we have been
extremely reluctant to make this change.
On the other hand, more and more European and Pacific rim companies (among others)
are opening manufacturing facilities in the United States. These companies work
exclusively in the metric mode. As time goes on, more and more American companies
will be forced to conform. It is likely that you will have to work in the metric mode at
some point in your CNC career.
How to select the inch or metric mode
Most CNC controls allow the measurement system (inch or metric) to be selected in two
ways. First, the operator is usually allowed to select the inch or metric mode manually,
through some kind of switch. The switch could be a physical toggle switch on the control
panel, or more likely, a switch displayed and set through the display screen. Second, the
programmer can usually select inch or metric by a preparatory function (G code). On
most controls, a G20 selects the inch mode and a G21 selects the metric mode. By this
method, the input mode can be selected from within a program, or by manual data input
mode (MDI).

Lesson Eleven: Inch / Metric Selection G20 & G21


The machine can usually be manipulated so the desired mode is initialized at power up.
If your company works exclusively in inch, the machine can be made to power up in the
inch mode. If your company works exclusively in metric, the machine can be made to
power up in the metric mode. This will keep the programmer from having to specify a
G20 or G21 in the program if the desired mode is used. The control will automatically
assume the correct mode when the machine is turned on.
You can easily tell which input mode is currently selected by looking at the coordinate
positions on the display screen. In the inch mode, almost all CNC machines will display
coordinate positions to four places of accuracy (down to .0001 in). In the metric mode,
the control will display coordinate positions to three places of accuracy (.001 mm). For
example, if the position display page of the control screen shows these values:
X12.2500
Y11.3750
Z08.8750
you would know the machine was currently set to the inch mode because four places
follow the decimal point. On the other hand, if the position display page of the control
screen shows these values:
X150.500
Y280.250
Z350.375
you would know the machine was currently in the metric mode because three places
follow the decimal point.
Do note that some high precision machines (especially turning centers) allow you to
program out to five places in the inch mode (five places displayed to the right of the
decimal point). These controls allow you to program out to four places in the metric
mode.
There are companies that utilize their CNC machines in both input modes. It may be
possible that about half of this companys workpiece prints are dimensioned in inch and
the other half in metric. For this company, it may be best to work in the most convenient
input mode. Keep in mind that this means a duplication of measuring devices. If your
company is one of the few that runs programs in both modes, we recommend that you
include the appropriate G20 (inch mode) or G21(metric mode) at the beginning of all
programs to avoid accidentally being in the wrong input mode. If no programmed
command tells the control which input mode to use, of course the control will assume the
input mode from the most recent program (if one exists) or the mode initialized at power
up.
If the control assumes the wrong mode, the results can be disastrous. If the program is
written in the metric mode, but the machine is set to the inch mode, all coordinate
position end points will be greatly enlarged. A value that was supposed to be taken as 5.0
mm (0.1968 in) will actually be taken as 5.0 inches.
On the other hand, if the program is written in the inch mode but when run, the machine
is set to the metric mode, coordinate position end points will be dramatically reduced. A
value of 5.0 inches will be taken as 5.0 mm (0.1968 in). In either case, the problems
2

Lesson Eleven: Inch / Metric Selection G20 & G21


created by being in the wrong input mode sets up potentially dangerous situations. The
inclusion of the proper input mode G code at the beginning of all programs will let you
avoid this possibility for disaster.
Other considerations when switching to metric mode
As you have seen, switching from one input mode to the other is not as simple as
throwing a switch. Though the machine will assume the correct mode in this manner,
your companys measuring devices, manual machine tools, and even the attitude of its
employees also affects the change from inch to metric and vice versa.
There are yet other considerations. When working in one input mode or the other, you
must work exclusively in the selected mode. For example, the measurement of the
program zero point must be made in the selected mode. If working in metric, the distance
from program zero to the machines starting point must be entered in the metric mode.
Tool offsets must also be entered in the selected mode. Say you intend to work in metric.
For machining centers, tool length offsets and cutter radius offsets must be entered in
metric. For turning centers, offsets to control machining size as well as tool nose radius
offsets must be entered in metric.
Note that most types of cutting tools must also be supplied in the selected input mode.
For example, if the design engineer dimensions a hole to be 10 mm in diameter, a 10 mm
drill must be used. Though there are times when you will find tooling in inch equivalents
that happen to match the metric tool requirements, these occurrences are purely
coincidental.
The advantage of the metric mode
If your company is currently working exclusively in the inch mode, you may see little
reason to change to metric. Surely, nothing presented to this point will have changed your
mind. It would take quite an investment of time and money to switch to metric. You will
probably want to continue machining workpieces in the Inch mode and convert those few
metric prints you come across to inch and run the parts in the inch mode. However, there
is one advantage to of working in the metric mode that is not very obvious. It has to do
with the least input increment of the machine tool in the selected input mode. The least
input increment is the smallest departure movement possible on the CNC machine. For
most CNC machines, the least input increment in the inch mode is 0.0001 in. In the
metric mode, the least input increment is 0.001 mm.
When converted to the inch mode, 0.001 mm is equal to 0.00003937 in (.001 divided by
25.4), so 0.001 mm is less than half of 0.0001 in. This means the machine has a much
finer resolution or movement grid when you are working in the metric mode. You can
target the end point of each movement command to a more precise position when
working in the metric input system. The next illustration shows the grid for the inch
mode as it compares to the grid for the metric mode (0.0001 grid as compared to 0.001
mm grid). This is a graphic illustration of how much more precise you can be with the
specification of end points in the metric mode. As you can see, the machines resolution
(set of possible end points for each command) is much finer in the metric mode.

Lesson Eleven: Inch / Metric Selection G20 & G21

0.001 mm

0.0001 in

Resolution of
inch mode

Resolution of
metric mode

Drawing shows the difference between the inch and metric modes

We are not saying that the machine is more accurate in the metric mode. The CNC
machine will perform to its quoted specifications in either mode. In the metric mode, you
can simply target your end points to with a finer precision.
We compare this to indexing devices. A five degree indexer has 72 positions. A one
degree indexer has 360 positions. This doesnt make the one degree indexer more
accurate than the five degree indexer; it simply has more programmable positions. When
you think about it, working in the inch mode when the metric mode is available is kind of
like have a one degree indexer but never programming it to less than two degree
increments.
In a similar way, the metric mode will allow the possible end points along a linear axis to
be more than doubled. Actually there will be 2.54 times the number of end points for any
linear axis in the metric mode than in the inch mode. For a linear axis that is ten inches
long, there are 100,000 possible programmable positions in the inch mode. For the same
linear axes, there are 254,000 possible programmable positions in the metric mode.
Note that the metric advantage does not apply to a rotary axis. Since all true rotary axes
are commanded in angular increments, there is no difference in the number of possible
end points from the inch mode to the metric mode. A position of 45 degrees is
commanded the same in both modes.

Lesson Eleven: Inch / Metric Selection G20 & G21


Selecting the mean value for a dimension
There are times when having the ability to select finer increments of motion will make
the difference between success and failure with a program. For example, when you are
trying to hold extremely critical tolerances on a workpiece, it may be helpful (if not
mandatory) to target each motion as precisely as possible.
When programming any workpiece, most programmers will select the mean dimension of
the tolerance for use as the programmed coordinate. This allows any cutting condition
problems to slightly affect machining yet be within the given tolerance. For example, for
the dimension
3.2500 in plus 0.0004 minus 0.0002
the programmer would use 3.2501 as the programmed coordinate, since it represents the
mean value of the specified tolerance (3.2500 plus 0.0004 minus half the overall
tolerance 0.0003).
However, there are times when the programmer cannot specify the precise value of the
mean tolerance in the inch mode due to the resolution grid limitations discussed earlier.
For example, for the dimension
3.2500 plus 0.0003 minus nothing
the mean value of this dimension is 3.25015 in. Since the least input increment in the
inch mode is 0.0001 in, the desired end point of the motion command cannot be
commanded in the Inch mode. In this mode, either the dimension would have to be
rounded up to 3.2502 in or rounded down to 3.2501 in. Either way, the programmed
value would be .00005 from the needed program value.
However, if the dimension is converted to metric the mean dimension end point
programmed can be much more precise. The value 3.25015 in metric is 82.5538 mm
(3.25015 times 25.4), which can be rounded to 82.554 mm. This coordinate is within
0.0002 mm (or 0.0000079 in) of being precisely the desired mean value coordinate.
When compared to the best possible inch mode value (within 0.00005 in), you can see
how much better the metric mode lets you target end points.
Offset considerations
Another time when using the metric mode will help with critical tolerances is when
offsetting. When an operator is trying to adjust the size of the workpiece with tool
offsets, the machines least input increment will again be the limitation. If in the Inch
mode, the operator will be limited to making offset adjustments in increments of 0.0001
in. In the metric mode, the operator is allowed to make much finer adjustments in 0.001
mm (.00003937 in) increments. This can sometimes mean the difference between being
able to hold size or not being able to hold size for critical tolerances.
Though the points made here are true for all kinds of CNC machines, the most common
time when you will have this kind of tolerance problem is on turning centers when trying
to hold close diameter tolerances. For example, say this Inch input mode diameter and
tolerance must be held on a turning center.
3.1250 in plus .0001 in minus nothing

Lesson Eleven: Inch / Metric Selection G20 & G21


In this case, the operator would have little or no chance to adjust the offset perfectly if
working in the Inch mode. Also note that the programmer would have to program the
value as either 3.1250 or 3.1251. In either case, the programmed coordinate would be on
a tolerance limit. The best the operator could hope for is to be very lucky when adjusting
the offset. By luck alone will the dimension come out to the mean dimension of the
tolerance.
However, when converted to the metric mode, 3.1250 inch is 79.375 mm. The tolerance
band of 0.0001 inch is .00254 mm when converted. This means the mean dimension of
the tolerance would be 79.376 mm (3.21505 times 25.4 rounded down to the next 0.001
mm). If run in the metric mode, the operator will have a much better chance of adjusting
the offset to conform to this dimension.
Admittedly, the tolerances we have been discussing are minute indeed, and in reality,
most companies will not have to work to such close tolerances. But when faced with the
task of handling such close tolerances, it is good to know the implications of working in
the metric mode. In these cases, you can convert the dimensions on the drawing to metric
and machine the workpiece in the metric mode.
How the control generates axis departure (inch versus metric mode)
Depending on the control manufacturer, the resolution of the CNC control will
sometimes determine how smoothly motion will occur. By resolution, we mean the size
of the smallest single axis departure when a movement of more than one axis is
commanded. When linear and circular commands (G01, G02, and G03), are given, the
actual motion occurs is along a series of tiny single axis motions. For most applications,
these motions will be so tiny that the end result will appear to be a perfectly straight line
or a perfectly round circle. But in reality, these motions are actually generated by a series
of tiny single axis motions as shown in the next drawing. The size of each step is the
determined by the controls resolution. The better the resolution, the smaller the step,
hence the smoother the motion will be.

Drawing shows the steps generated by any motion command

Lesson Eleven: Inch / Metric Selection G20 & G21


For some current CNC controls, the controls resolution is exactly the same (and the best
it can be) no matter which input mode is selected (inch or metric). However, the
resolution of some (especially older CNC controls) is dramatically affected by which
input mode is selected. In fact, many times the least input increment is the actual step
value determined by the controls resolution.
If this is the case, the controls motion capabilities will be directly affected by whether
the control is in the inch or the metric mode. That is, in the inch mode the resolution
(step size) will be 0.0001 in. In the metric mode, the resolution will be 0.001 mm (or
0.00003937 in). This means the control can make smoother movements in the metric
mode than in the inch mode.
For most applications, there would be no indication of this limitation in the Inch mode.
The tiny 0.0001 in steps would seldom be detectable. Also, newer controls have the same
resolution in either mode, meaning you would never be faced with any problems
stemming from resolution differences based on the input mode.But there is one kind of
problem you may come across at some point in your career we wish to warn you about.
The next drawing shows a workpiece to be machined on a turning center that requires a
very tiny taper on the face of the part (though not to scale). If this part is to be
programmed in inch mode, and if the resolution of the control is set by the least input
increment (0.0001 in in this case), the desired motion could not be generated.

Drawing shows workpiece with small taper on face

The next drawing shows what will happen. Notice that since only 0.0002 taper is
generated on the face in the Z axis, the control would simply divide this motion by the
least input increment (0.0002 divided by 0.0001 is 1) and break the command down into
two steps. No true taper could be generated.

Lesson Eleven: Inch / Metric Selection G20 & G21

Drawing shows what will happen on face of workpiece in inch mode

In the metric mode, since the least departure increment is less than half of that in the inch
mode, the motion would be much better, though still not perfect. The next drawing
shows the same motion if made in the metric mode.

Drawing shows what will happen on face in metric mode

Lesson Eleven: Inch / Metric Selection G20 & G21


Keep in mind that some (especially newer) CNC controls do not base the controls
resolution on the least input increment. With this kind of control, the resolution (step
size) is even smaller than the least input increment, even in the metric mode. This means
the above mentioned problem may never occur.

Вам также может понравиться