Programming of CNC Machines. Ken Evans
Programming with an incremental coordinate system is based upon the determination of the tool path from its current position to its next consecutive position and in the direction of all the axes. Sign determines the direction of motion. Based on the drawing from the previous example, we can illustrate the tool path in an incremental coordinate system, starting and ending at P1.
X | Y | |
P 2 | 0.0 | 10.5 |
P 3 | 2.5 | 0.0 |
P 4 | 0.0 | –2.0 |
P 5 | 3.0 | 0.0 |
P 6 | 1.0 | 1.0 |
P 7 | 0.0 | 2.5 |
P 8 | 4.5 | 0.0 |
P 9 | 0.0 | −11.0 |
P 10 | −1.0 | −1.0 |
P 1 | −10.0 | 0.0 |
Coordinate Input Format
CNC machines allow input values of inches (specified by the command G20), millimeters (specified by the command G21), and degrees using a decimal point with significant zeros in front of (leading) or at the end (trailing) of the values. When using inch programming, the two ways distances can be specified:
Programming with a decimal point:
1 inch = 1. or 1.0 1
1/4 inch = 1.250 or 1.25
1/16 inch = 0.0625 or .0625
Programming with significant trailing zeros:
In this case, the zero furthest to the right corresponds with the ten thousandths of an inch.
1 inch = 10000
1 1/8 inch = 11250
1 1/32 inch = 10313
These two coordinate input formats (G20 and G21) are the standard on all CNC machines.
With modern controllers, neither leading nor trailing zeros are required—the decimal placement is the significant factor. In this case, the input is as follows:
1 inch = 1. or 1.0
1 1/4 inch = 1.25
1/16 inch = .0625 or 0.0625
The language described in this book is used for controlling machine tools and is known informally as “G-Code”. This language is used worldwide and is reasonably consistent. The standard by which it is governed was established by the Electronics Industries Association and the International Standards Organization, called EIA/ISO for short. Because of this standardization, a program created for a particular part on one machine may be used on other similar machines with minimal changes required.
Each program is a set of instructions that controls the tool path. The program is made up from blocks of information separated by the semicolon symbol (;). This symbol (;) is defined as the end of the block (EOB) character. Each block contains one or more program words. For example:
Word | Word | Word | Word | Word |
N02 | G01 | X3.5 | Y4.728 | F8.0 |
Each word contains an address, followed by specific data. For example:
Address | Data | Address | Data | Address | Data |
N | 02 | G | 01 | X | 3.5 |
Chart 1-4 is a list for all of the letter addresses that are applicable in programming, along with brief explanations for each. Chart 1-5 then lists symbols commonly used in programs.
ADDRESS CHARACTERS | |
CHARACTER | MEANING |
A | Additional rotary axis parallel and around the X-axis |
B | Additional rotary axis parallel and around the Y-axis |
C | Additional rotary axis parallel and around the Z-axis |
D |
Tool radius offset number; (Turning) Depth of cut for multiple repetitive |