Copyright 1997 by Mark Bennett. These pages may be copied or printed for personal use so long as they remain complete and include this copyright message.
These pages are available to download as a 82k zip file which may be freely installed on any machine.
This is a rough starter guide to CNC programming not a machine manual, no responsibility can be taken by the site operators for any loss or damage resulting from the application of the principles described here. Read your manuals for precise details of your machines.
How to put it all together
I'm a CNC Programmer with almost 10 years experience mainly on 4 and 5 axis Routers machining thermoformed plastic components.
Although there are standards for CNC controls most machine manufacturers have their own ways of doing things. In my experience these are the most common features across a range of machines. This is a rough starter guide to programming, not a machine tool manual.
Read your manuals to gain knowledge about your specific machines.
A "CNC Program" is made up of one or more "BLOCKS". Each block contains one or more "WORDS". A word is generally an "ADDRESS REGISTER" followed by a "VALUE".
An example of a Block is N540 G2 X30 Y-20 R-12 M8
It contains the words N540, G2, X30, Y-20, R-12 and M8.
The Addresses N, G, X, Y, R and M are used with the values 540, 2, 30, -20, -12 and 8
The machine control executes each block in turn. Additionally the words in a block are executed in a specific order. For example an M code instruction is executed before any axis movement in the block, so in the above block the coolant will come on at the start of the axis travel.
Some controls only allow each address letter once in a block, others allow a number of codes in the same block.
Some controls also demand leading zeros on values and codes, for example G02 not G2.
A block starts with a block number, it is normal practice to start at one hundred and go up in tens. This allows extra blocks to be added easily.
Generally it is only necessary to program changes, once a mode has been programmed it will remain active until another code from the same group is programmed.
Address register letters
S Spindle speed
T Tool number
G codes are preparatory functions, they control the way the machine generates axis movement.
Most G codes come in groups, for example G17, G18 and G19 are a group. Only one code in a group may be active at any one time, programming another code in that group switches to another mode.
Cutter radius compensation
G92 Set or cancel datum shift
Program control codes
M0 Program stop
M2 End of cycle
M30 End of program
M3 Spindle start clockwise
M4 Spindle start counter clockwise
M5 Spindle stop
M6 Tool change
M7 Mist coolant on
M8 Flood coolant on
M9 Coolant off
How to put it all together