Alphabetic & Special Address Codes

Every letter of the alphabet is used as a machine address code. In fact, some are used more than once, and their meaning changes based on which G-code appears in the same block.

Codes are either modal, which means they remain in effect until cancelled or changed, or non-modal, which means they are effective only in the current block.

The table below lists the most common address codes.

Code

Meaning

ARotation about X-axis.
BRotation about Y-axis.
CRotation about Z-axis.
DCutter diameter compensation (CDC) offset address.
FFeed rate.
GG-Code (preparatory code).
HTool length offset (TLO).
IArc center X-vector, also used in drill cycles.
JArc center Y-vector, also used in drill cycles.
KArc center Z-vector, also used in drill cycles.
MM-Code (miscellaneous code).
NBlock Number.
OProgram Number.
PDwell time.
QUsed in drill cycles.
RArc radius, also used in drill cycles.
SSpindle speed in RPM.
TTool number.
XX-coordinate.
YY-coordinate.
ZZ-coordinate.

Table 5.2: Common Alphanumeric Address Codes

Alphabetic Address Code Definitions

Here are the most common alphabetic address code definitions, examples and restrictions of use. Most modern machines use these codes.

A,B,C - 4th/5th Axis Rotary Motion

Rotation about the X, Y or Z-axis respectively. The angle is in degrees and up to three decimal places precision.
G1 A30.513 B90.

D - Tool Diameter Register

Used to compensate for tool diameter wear and deflection. D is accompanied by an integer that is the same as the tool number (T1 uses D1, etc). No decimal point is used. It is always used in conjunction with G41 or G42 and a XY move (never an arc). When called, the control reads the register and offsets the tool path left (G41) or right (G42) by the value in the register.
G1 G41 X1. D1

F - Feed Rate

Sets the feed rate when machining lines, arcs or drill cycles. Feed rate can be in Inches per Minute (G94 mode) or Inverse Time (G93 mode). Feed rates can be up to three decimal places accuracy (for tap cycles) and require a decimal point.
G1 X1. Y0. F18.

G - Preparatory Code

Always accompanied by an integer that determines its meaning. Most G-codes are modal. Expanded definitions of G-codes appear in the next section of this chapter.
G2 X1. Y1. I.25 J0.

H - Tool Length Compensation Register

This code calls a tool length offset (TLO) register on the control. The control combines the TLO and Fixture Offset Z values to know where the tool is in relation to the part datum. It is always accompanied by an integer (H1, H2, etc), G43, and Z coordinate.
G43 H1 Z1.

I - Arc Center or Drill Cycle Data

For arc moves (G2/G3), this is the incremental X-distance from the arc start point to the arc center. Certain drill cycles also use I as an optional parameter.
G2 X.1 Y2.025 I0. J0.125

J - Arc Center or Drill Cycle Data

For arc moves (G2/G3), this is the incremental Y-distance from the arc start point to the arc center. Certain drill cycles also use J as an optional parameter.
G2 X.1 Y2.025 I0. J0.125

K - Arc Center or Drill Cycle Data

For an arc move (G2/G3) this is the incremental Z-distance from the arc start point to the arc center. In the G17 plane, this is the incremental Z-distance for helical moves. Certain drill cycles also use J as an optional parameter.
G18 G3 X.1 Z2.025 I0. K0.125

M - Preparatory Code

Always accompanied by an integer that determines its meaning. Only one M-code is allowed in each block of code. Expanded definitions of M-codes appear later in this chapter.
M8

N - Block Number

Block numbers can make the CNC program easier to read. They are seldom required for CAD/CAM generated programs with no subprograms. Because they take up control memory most 3D programs do not use block numbers. Block numbers are integers up to five characters long with no decimal point. They cannot appear before the tape start/end character (%) and usually do not appear before a comment only block.
N100 T2 M6

O - Program Number

Programs are stored on the control by their program number. This is an integer that is preceded by the letter O and has no decimal places.
O0002 (PROJECT 1)

P - Delay

Dwell (delay) in seconds. Accompanied by G4 unless used within certain drill cycles.
G4 P.1

Q - Drill Cycle Optional Data

The incremental feed distance per pass in a peck drill cycle.
G83 X1. Y1. Z-.5 F12. R.1 Q.1 P5.

R - Arc Radius or Drill Cycle Optional Data

Arcs can be defined using the arc radius R or I,J,K vectors. IJK's are more reliable than R's so it is recommended to use them instead. R is also used by drill cycles as the return plane Z value.
G83 Z-.5 F12. R.1 Q.1 P5.

S - Spindle Speed

Spindle speed in revolutions per minute (RPM). It is an integer value with no decimal, and always used in conjunction with M3 (Spindle on CW) or M4 (Spindle on CCW).
S3820 M3

T - Tool number

Selects tool. It is an integer value always accompanied by M6 (tool change code).
T1 M6

X - X-Coordinate

Coordinate data for the X-axis. Up to four places after the decimal are allowed and trailing zeros are not used. Coordinates are modal, so there is no need to repeat them in subsequent blocks if they do not change.
G1 X1.1252

Y - Y-Coordinate

Coordinate data for the Y-axis.
G1 Y1.

Z - Z-Coordinate

Coordinate data for the Z-axis.
G1 Z-.125

Special Character Code Definitions

The following is a list of commonly used special characters, their meaning, use, and restrictions.

% - Program Start or End

All programs begin and end with % on a block by itself. This code is called tape rewind character (a holdover from the days when programs were loaded using paper tapes).

( ) - Comments

Comments to the operator must be all caps and enclosed within brackets. The maximum length of a comment is 40 characters and all characters are capitalized.
(T2: .375 END MILL)

/ - Block Delete

Codes after this character are ignored if the Block Delete switch on the control is on.
/ M0

; - End of Block

This character is not visible when the CNC program is read in a text editor (carriage return), but does appear at the end of every block of code when the program is displayed on the machine control.
N8 Z0.1 ;