In this article, we take a look at the correct terms to use when talking about our G-code programs.
This is how the machine will identify our programs, it is good practice to keep a spreadsheet of our part numbers with program numbers so we don’t create more than one program with the same number.
The program number always starts with the letter ‘O’ followed by four digits and is the first line of any program.
To call up a subprogram from within a program we would use ‘P’ before the number such as ‘P0001’
A sequence number used to be at the start of each line, but with modern programming techniques, we use an ‘N’ number when we need to jump to or recall a part of the program.
Sequence numbers are also used to identify a part of the program that we wish to reference. For example, if we were writing a roughing subroutine that we wish to recall when we run a finishing cycle we can use the line:
G70 P100 Q200;
The P100 and Q200 tell the controls to look for N100 and read our subprogram until N200 is found within the program.
For more on this, head over to my article on CNC
Lathe roughing cycles.
The part program refers to the section of a program which contains all the info needed for executing the cutting process carried out by a single cutting tool.
The phrase ‘Part Program’ is sometimes also used to reference the complete program that is used to program a part.
Below is an example of a part program that taps 3 holes.
N5 T0505 (M5 TAP);
G90 G95 G54 G21 G17 G80;
G00 X20.0 Y20.0 Z5.0 M08;
G84 Z-12.0 R5.0 Q3.0 F0.8;
G00 Z50.0 M09;
G53 X0.0 Y0.0 Z0.0;
Notice the sequence number at the beginning of the part program, we can use this number to search for this part of the program by typing N5 into the Fanuc controls and pressing the down arrow.
More about programming tapping cycles here.
An address is expressed using the letters of the alphabet.
G X Z
The numbers and dimensions that follow the address.
The minimum unit to specify a function
The address and data combined equal a word.
A block is the minimum command unit necessary to operate a machine. It is also the minimum unit used to create a part program.
A block consists of words.
Each line of a program is regarded and one block. That ends with the end-of-block (EOB) sign ;.
A typical block may look like this:
G01 X100.0 Y200.0 Z10.0 F100.0 M08;
A program consists of words, a combination of address, data and of blocks that when combined will give the machine all the information needed to produce our part.