CNC Code Terms
OBJECTIVES
After completing this unit, you should be able to:
- Identify and describe an address in CNC Code
- Identify and describe a word in CNC Code
- Identify and describe an argument in CNC Code
- Identify and describe a block in CNC Code
- Identify and describe a line number in CNC Code
In the IMTL-136 introductory class, attention was given to the headers, body, and footers. The programming is going to get more detailed in this advanced CNC class.
Let’s take a look at terminology of the different parts of the code.
Anatomy of a Program
Many potential programmers are turned away from G-Codes when they see a typical program. G-Code seems pretty cryptic at first glance, however by learning just a few codes you will be able to read about 90% of a typical program. For instance, by learning the code G01 (Linear cutting move), you would probably be able to figure out that the following code excerpt cuts a square with one corner located at the origin:
…
G01 X0.0 Y0.0 F8.0;
G01 X2.0 Y0.0;
G01 X2.0 Y2.0;
G01 X0.0 Y2.0;
G01 X0.0 Y0.0;
…
Warning! Do not run any code on a real machine until you know exactly how your particular machine will interpret the program.
As the saying goes, a little knowledge is a dangerous thing. It would be very dangerous to run the code excerpt as it is. As you will see, there are many settings that affect how the controller interprets the G-Codes, and these must never be assumed.
Also, this code could be simplified a little further as we will soon see. But the general idea is pretty easy to follow once you know what G01 means. Below, we will look at individual codes like G01 in detail, and see how we can eliminate any assumptions that could result in dangerous or unexpected machine movements.
A code snippet like the one above leaves too much room for doubt as to how the machine will react. For example, do the coordinates represent actual locations, or do they represent a distance to move (absolute or incremental)? Are they in reference to the machine origin or some other coordinate system? How fast should the tool go, and which tool should the machine use? These kinds of questions are cleared up by adding some more detail to the code. The following code is a little more realistic. Don’t worry if you don’t understand much about it at this point, we will go through each part.
% N010 (***BEGIN HEADER***); N020 (DESCRIPTION: PART NUMBER U23-0020 REV C, MILL TOP SIDE); N030 (SEE SETUP DESCRIPTION ON PROCESS ROUTING SHEET); N040; N050; N070 G17 G20 G40 (XY PLANE, INCH MODE, CANCEL CUTTER COMP); N080 G55 G80 G90 G94 (ORIGIN, CANNED CYCLE CANCEL, ABS., FEED PER MIN.); N090 G43 (TOOL LENGTH COMPENSATION ON); N100; N110 (***END HEADER***); N120; N130 T01 H01 (TOOL NO. 1, TOOL OFFSET 1); N140 M06 (TOOL CHANGE); N145 M02 (SPINDLE ON); N150 G00 X-0.5 Y-0.5 (RAPID TO POINT NEAR ORIGIN); N160 G01 X0.0 Y0.0 F8.0 (POSITION TOOL OVER ORIGIN); N170 Z0.0 (LOWER TOOL TO Z0.0); N180; N190 X2.0 Y0.0 (BEGIN CUTTING RECTANGLE); N200