CNC programmer and most of CNC machine operators have a simple chart of all
common G-commands (G-codes) and M-functions (M-codes), usually tucked away
somewhere under the lid of their tool box or they have them posted on any
convenient machine side or cork board. This chapter covers most of those
G-codes that are either uncommon, seldom used, special, or outright mysterious.
Keep in mind that machine manufacturers often add G-codes and M-codes of their
own. These special codes or functions cannot be covered in a general
publication, such as this handbook.
functions (M-functions) are not covered here at all, as they are often very
much dependent on the machine tool manufacturer - for that reason, they are not
part of this chapter. The situation is much different with various G-codes,
some standard, some optional - they are covered here.
special and less frequently used G-codes are as important as those used on a
daily basis, even if only as accepting them for possible future use.
Programmers often forget that there are many preparatory commands available
that are not used very frequently. In this chapter, the focus will be on those
G-codes that may sometimes become the key to solving a particular problem or
achieving a particular programming goal. Some of these preparatory G-codes have
a direct relationship with each other, in which case, all related commands will
be considered together and explained together.
into seven groups, seventeen preparatory commands covered in this chapter are:
studying this section, please take note:
speed is programmed in revolutions per minute (r/min or rpm). For example, the
program may contain S1000 M03, selecting 1000 r/min at normal rotation.
Ideally, the spindle should run at the constant 1000 r/min, however, that is
not always the case. The actual spindle speed will fluctuate slightly, which is
normal. Just watch the display of the spindle speed at the control. In most
cases, the speed fluctuation (also called spindle speed variation) can be
ignored, as it presents no problem. For those cases, when the fluctuation is
high, the control system provides two preparatory commands:
that the G26 command does not actually remove the fluctuation, it only
. It only monitors it, and issues and alarm if
the spindle is
- the main reason for spindle
fluctuation is heat. The format for G26 uses three entries (Fanuc 16-18 format
P = Time in milliseconds to start the
Q = Percentage of allowed tolerance
R = Percentage of spindle speed fluctuation
above descriptions are rather brief, and do not indicate what exactly happens.
Using an example for spindle speed of 1000 r/min, the meaning of individual
entries should becomes clearer.
value is the time in milliseconds (ms) that is
counted from the spindle rotation function
the start of check for possible overheating. The checking will start only if
the programmed spindle speed is actually established during the time specified
it is selected as 2000 ms; the system will check
if the programmed spindle speed is reached within 2 seconds.
value is specified as a percentage of allowed
tolerance from the programmed spindle speed. For example,
is 5% of S1000, which is 1000/100
50. Subtracting 50 from the programmed speed results in 950 r/min for the
spindle speed to reach. If the programmed speed is within 950 and 1000 r/min,
the check of actual spindle speed begins.
value is the percentage of spindle speed
fluctuation where the spindle speed is too fast and overheating is possible.
is 10% of the programmed spindle speed, and
10 = 100. Subtracting 100 from the programmed
speed results in 900 r/min as the speed when alarm will be generated. Alarm
will be issued if overheating is likely to occur.
the critical speeds are known, in which case the individual values of
have to be calculated. There
are two formulas to use for this purpose:
A = Actual spindle speed
H = High speed at which overheating is
S = Programmed spindle speed
950, H = 900
S = 1000
Q = (1 - 950 / 1000)
100 = 5
R = (1 - 900 / 1000)
100 = 10
Copyright © 2006
Industrial Press Inc.