Professional Documents
Culture Documents
G Code Commonalities
As you know, G codes are preparatory functions. They prepare the control for what is
coming - in the current command, or in future commands. Most G codes are modal,
meaning they will remain active until they are changed or canceled. All motion types, for
example, are modal. Once you instate a straight line cutting motion (G01) in one
command, you need not include a G01 in every consecutive straight line motion
command.
Some G codes, on the other hand are non-modal or one-shot G codes. These special G
codes only take effect in the single command in which they are included. The zero return
command (G28), for instance, is a non-modal G code. If two or more consecutive
commands are given to send axes to their zero return position, a G28 must be included in
each command.
Before we get specific and discuss each individual G code, we need to introduce some
things that G codes share in common. Weve already mentioned, for example, modal and
non-modal G codes. There are several important points that are commonly left out of
basic CNC courses.
Maximum number of G codes per command
All controls limit the number of G codes you can include in one command. Most Fanuc
controls, for example, allow but three compatible G codes per command. By compatible,
we mean the G codes must be able to work together. You cannot, for instance, include a
G00 rapid motion word in the same command with a G01 straight line motion word.
You must understand that when you include more than three G codes in the same
command, most controls will not actually generate an alarm. Instead, they will simple
execute the last three (rightmost three) G codes. Any prior to them will be ignored.
Ensuring initialized states with safety blocks
Certain G codes are initialized, meaning they are automatically instated during the
machines power-up procedure. For certain functions, youll have the ability to change
the G code that is initialized. If, for example, you work exclusively in the inch mode,
youd want the machine initializing in the inch mode. If you work exclusively in metric
mode, youd want the machine initializing in metric. You can also manipulate whether
the machine comes on in incremental or absolute mode (G91 or G90), and rapid or
straight line cutting mode (G00 or G01). Control parameters are used to specify which of
these G codes is initialized.
Many programmers depend upon these G codes being as they were at power-up when
their programs are run. This can be a nasty mistake. I constantly get a call for help that
goes something like this:
Customer: Mike, my CNC turning center is barely creeping along in a cutting motion. I
notice the position display going 1..... 2...... 3......, and this is the tenths register of the
position display page. Ive programmed the machine to go at 0.015 inches per revolution
and the spindles running at 600 rpm. It should be cutting much faster!
Me: Oh - youve been trying to use sub-programming commands.