We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 2
Programming with Codes
A program is just a set of written instructions given in the order they are to be performed.
Imagine if we could send the machine an “E-Mail” in plain English telling it what we wanted it to do. The
program would look something like this:
STEP #1 SELECT CUTTING TOOL
STEP #2 = TURN THE SPINDLE ONAT A CERTAIN RPM
STEP #3 TURN THE COOLANT ON
STEP #4 RAPID TO OUR START POSITION
STEP HS, MAKE OUR CUTS AT A CERTAIN FEED RATE
STEPHE ‘TURN OFF THE SPINDLE AND THE COOLANT
STEP#7 = RETURN TOOL TO HOME AND SELECT NEXT TOOL
and soon, But our machine control only understands these messages when given in machine code.
Why do we use G&M Code and not a different language (English for example)?
CNC Machines were first built in the 1940's and 50's with the invention of computers. They were custom
built, and several companies were trying to come to market with the first consumer available NC machine
tools.
It was the early 60's before CNC machines became commercially available, and not only was the machine
invented, so was the computer, and the software to run the computer. These first computers were limited
and didn’t have enough memory to remember an entire language such as English. So “Code” had to be
invented, and was limited to words that had one letter and two numbers behind it (6 0 0 for Example).
Several inventors came out with machine and controls inthe early days, and each one had to invent their
own “code”. Soon there were several brands and several different kinds of code. This is when the ISO
(international Standards Organization) said they were going to set a “Standard” code. They went with the
code that was by far the most popular at the time, FANUC. This is why itis also referred to as “Fanuc G-
Code”
‘The basics of this code remain the same to this day. Things get added from time to time, and it just adds
ew codes to the end of the G-Code list. Last code invented was G187 Machine Accuracy Control, and
came out in the late 1990's. The first G-Codes were G00, G01, G02, and G03. They were established in the
50's. As a new need for a new machine “mode" is invented, new G-Codes will get added on to the list.
Why do we stick with the code since technology has come so far?
‘Standardization and Familiarity: It has been a great benefit in many ways. Operators and programmers
trained on one machine can move to another brand, control, shop, etc...and with a little familiarization
can get up to speed quickly. Companies can share programs.
Productivity Inc- Haas CNC Mill Programming Manual Page29Program Structure
In the CNC world, the term “Block’ is used to define what we know as a line of code. The reason it is
called a block is that the machine can read the entire line all at once, not from left to right as we are used
to. A typical program consists of one or more blocks of commands.
After each block we need to end the block with a semi-colon (}). On the operators panel, the EOB key (End
of Block) will generate this symbol. This is how the machine tells one line of code from the next.
The" / "symbol, sometimes called a forward slash, is used to define an optional block. A block that
contains this symbol can be optionally deleted when the machine is in the block delete mode (BLKDEL)
when running a program.
‘The machine does not read left to right as we do, again it takes a whole block in at one time. We can
arrange our G-Codes, M-Codes, and Alphabetic Address Codes (X, Y, Z, etc...) in any order we want. The
rules are we can have one (G-Code) from each group, only one(IM-Code), and alpha characters on each
line. The machine will ALWAYS run the G-Codes and alpha characters first and the M-Code last.
G00 G17 G40 G49 G80 G90 G98 {Safety Line)
GOO Rapid
G17 Selects X-Y Work Plane
G40 Cancels Cutter Comp
G49 Cancels Tool Length Offset
G80 Cancels Canned Cycle
G90 Absolute
G98 Initial Point Return for canned cycles
69162820 G28 This preparatory function causes a return to machine zero of all
(G00 653 20) specified axes. If an X, Yor2 are specified, only those axis,
move incrementaly (G91) to machine home.
T1M06 T1 Selects tool number one to be loaded into the spindle,
MO6 Activates the tool change sequence.
690 G54 GOO X_Y__ $1200 M03
G90 Activates control to be in ABSOLUTE.
G54 Selects work coordinate system No. 1.
G00 Preparatory function fora Rapid Movement.
X____ Axis move to initial "x" position,
Y____ Axis move to initial "Y” position.
$1200 Informs the control that 1200 has been selected as the RPM for this tool
M03. Turns the spindle “ON” in a clockwise direction at a speed of 1200 RPM.
G43 HO1 Z.1 MOB —.G43_Activates the tool length stored in the “H” code offset number.
HO1 Informs control as to what the stored offset value is.
Z.1 Informs the control to move from full spindle retract to this “2” value and
apply the tool length offset.
MOB Turns the coolant “ON.”
Productivity Inc- Haas CNC Mill Programming Manual Page30