CNC | Programming Formats


Since the early days of numerical control, three formats had become significant in their time. They are listed in the order of their original introduction:

  • Tab Sequential Format : No decimal point available (Old NC systems only)
  • Fixed Format : No decimal point available ( Old NC systems only )
  • Word Address Format : Decimal point available ( Typically used with CNC systems )

Only the very early control systems use the tab sequential or fixed formats. Both of them disappeared in the early 1970’s and are now obsolete. They have been replaced by much more convenient Word Address Format. Its greatest benefit is using addresses for words and decimal point format when necessary.

Word Address Format

The word address format is based on a combination of one letter and one or more digits – Figure 7-1.

Figure 7-1
Typical word address programming format

In some applications, such a combination can be supplemented by a symbol, such as a minus sign or a decimal point. Each letter, digit or symbol represents one character in the program and in control memory. This unique alpha-numerical arrangement creates a word, where the letter is called the word address, followed by numerical data with or without symbols. The word address refers to a specific register of the control memory. Some typical words are:

G01 M30 D25 X15.75 N105 H01 Y0 S2500 Z-5.14 F12.0 T0505 T05 /M01 B180.0

The address (letter) in the block defines the word meaning and must always be written first. For example, X15.75 is correct, 15.75X is not. No spaces (space characters) are allowed within a word – X 15.75 is not correct – spaces are only allowed before the word, meaning before the letter, between words.

You may be interested also:
“CNC Miscellaneous Functions | M Codes”

Data always indicate the word numerical assignment. This value varies greatly and depends n the preceding address. It may represent a sequence number N, a preparatory command G, a miscellaneous function M, an offset register number D or H, a coordinate word X,Yor Z, feedrate function F, spindle function S, tool function T, etc.

Any one word is a series of characters (at least two) that define a single instruction to the machine control unit. The above examples of typical words have the following meaning in a CNC program:

G01 : Preparatory command
M30 : Miscellaneous function
D25 : Offset number selection – milling applications
X15.75 : Coordinate word – as a positive value
N105 : Sequence number (block number)
H01 : Tool length offset number
Y0 : Coordinate word – as zero value
S2500 : Spindle speed function
Z-5.14 : Coordinate word – as a negative value
F12.0 : Feedrate function
T0505 : Tool function – turning applications
T05 : Tool function – milling applications
/M01 : Miscellaneous function w/block skip symbol
B180.0 : Indexing table function

Individual program words are instructions grouped together to form logical sequences of programming code. Each sequence that will process one series of instructions simultaneously forms a unit called a sequence block or program block or – simply a block. The series of blocks is arranged in a logical order that is required to machine a complete part or a complete operation is called a part program also known as a CNC program.

The next block shows a rapid tool motion to the absolute position of X13.0 Y4.6 within current units setting and with a coolant turned on:

N25 G90 G00 X13.0 Y4.6 M08
N25 Sequence or block number
G90 Absolute mode
G00 Rapid motion mode
X13.0 Y4.6 Coordinate location
M08 Coolant ON function

The control will always process any single block as one complete unit – never partially. Most controls allow a random word order in a block, as long as the block number is specified first. Many programmers follow an unofficial – but recommended – order of various words in a block. For example,G-codes are listed first, followed by axes data, than all remaining instructions.

Block number must always be specified first!