Understanding common CNC protocols.
LIKE ANY COMPUTER-BASED system, CNC has a protocol -- that is, the way you have to program it to do its work. The primary protocol is language. CNC language is often specific to a particular machine from a particular manufacturer, but some elements are constant. For example, any line or block (the two terms are interchangeable) of program that appears on a display screen consists of six "words." Following is an example of a line of a program:
N01 - the line (block) number
G02 - the preparatory code
X3.0 - movement in the X-axis
Z4.5 - movement in the Z-axis
F.5 - feed speed
M30 - miscellaneous code
How a particular CNC machine handles the words it uses as well as leading and trailing zeros in its words is built into its controller. The machine's protocol must be followed in order to program it. The CNC machine doesn't care whether the G code you select is the proper one or whether the X and Z positions you programmed are correct; it does what it is told by the program.
G codes, and to a certain extent M codes, are the foundation of CNC programming. G codes prepare and introduce certain operations to occur on the machine. They are a two-digit number (00 to 99) preceded by the word address letter "G." This G code determines the mode of operation for the machine. There have been attempts to standardize G codes among manufacturers and many are common to some degree, but many companies still use proprietary codes that are particular to their machines. Regardless of manufacturer, G codes are used to perform the following four operations:
1. Select a measurement system (English or metric);
2. Program for compensation and differences in tool lengths and diameters;
3. Select a movement system, i.e., rapid traverse or programmed feed rate;
4. Select a preset sequence of events known as canned cycles.
A few G codes that seem to be standard across brands of CNC equipment are G00 (rapid traverse for point-to-point positioning), G01 (linear interpolation), G02 (circular interpolation clockwise), and G03 (circular interpolation counter-clockwise). G codes are further designated as either modal or nonmodal. Modal G codes remain in effect in the program until they are replaced or canceled by another G code. Nonmodal G codes are good only for the line of programming in which they appear.
M (for miscellaneous) codes act as on/off switches for the functions they control. They vary widely between different machines (even more than G codes) because the number of programmable con trolled switching functions vary widely from machine to machine. A few of the more common ones are M00 (program stop), M03 (spindle rotation clockwise), M04 (spindle rotation counterclockwise), M06 (tool change), and M30 (program stop and rewind). Like G codes, M codes are also modal and nonmodal. If a machine has a particular need, for example, to turn vacuum on and off, an M code will be included in its programming protocol.
At a bare minimum, any CNC machine's programming codes should comply with ANSI/EIA standard RS-274-D; that is:
A = Rotation about the X axis
B = Rotation about the Y axis
C = Rotation about the Z axis
F = Feed rate commands
G = Preparatory functions
I = Circular interpolation X-axis offset
J = Circular interpolation Y-axis offset
K = Circular interpolation Z-axis offset
M = Miscellaneous commands
N = Sequence number
O = Sequence number for secondary axis commands
R = Arc radius
S = Spindle speed
T = Tool number
X = X-axis data
Y = Y-axis data
Z = Z-axis data
Taken together, these codes tell the machine what to do, but not where to go. That function is left to the machine axes and coordinates.
Machine Axes and Coordinates
The Electronic Industries Assn. (EIA) standards RS-267-A list 14 different designations of axes of motion. No one machine will have all 14, and only the more complex machine configurations will have as many as four. The three primary linear motions are X, Y and Z. The primary Z motion is parallel to the centerline of the main spindle and is that movement that advances or retracts the main spindle in a three-axis machine. The primary X motion is the longest travel perpendicular to Z and is normally horizontal. The primary Y motion is the shortest travel perpendicular to Z. Characters A, B and C designate rotary motion around the X, Y and Z axes, respectively.
Two-axis machines like lathes have an X and Z axis. The Z axis is parallel to the spindle rotation and moves the tool carrier left and right. The X axis is at right angle to the spindle and moves the tool carrier away from the operator and toward the operator.
Three-axis machines like routers have X, Y and Z primary axes. Most three-axis machines conform to the EIA standard, but there is some variation since some machines have moving bridges (router head carriers) and some have moving tables. But all of these axes are useless without the Cartesian coordinate system.
Cartesian coordinates permit the CNC machine to locate a point in 2D and/or 3-D space. The 2-D coordinate system consists of a Y (vertical) axis and art X (horizontal) axis. Where these two axes cross is the system origin (zero point). This results in four quadrants: Q1, Q2, Q3, Q4. Each of the two axes are divided into equal distances starting at the origin. These distances from the origin are either positive or negative, depending on where they are located with regard to the origin and quadrant within which they are located.
To locate a point in 3-D space, it is necessary to add a third axis: the Z axis. This permits locating a tool carrier at a point front-to-back, side-to-side and up-and-down. The origin or zero point of these three axes is still where all three cross. As already mentioned, the Z axis is the one in which the rotating spindle is located on both two- and three-axis machines. The directions of the X and Y axes may vary front machine to machine depending on, which direction of movement is shorter and which is longer.
RELATED ARTICLE: CNC To Buy or Not to Buy
TOP TEN things to consider before purchasing a CNC machine:
 Does the machine come with an already-written program or must the buyer write it?
 Does the manufacturer provide technical support?
 Does the programming protocol comply at least with the EIA RS-274-D standard?
 Will the CNC machine do better what is already being done without it?
 Does the size of machine fit your requirements and budget?
 Is a maintenance kit available for purchase?
 What accessories are needed and are they an extra cost?
 What kind of warranty comes with the machine?
 Will the manufacturer provide training on the machine?
 Will the CNC machine provide a worthwhile economic advantage over the machine currently in use?
Answers to these questions will lead to further questions that need to be answered. If all else fails, read How to Buy a CNC Route, by Todd A. Herzog, president of Accu-Router.
Dr. John P. Schenck is professor of industrial technologies at Northern State University in Aberdeen, SD. He can bereached at (606) 626-7708.
PRAVEEN (Member): z axis slips while working 4/20/2009 2:09 AM
we have a cnc wood router, we are facing some problems with the z axis, while working some times the z axis slips down by 10mm of the actual value and the job getting spoiled, please let me know how do i solve the problem, the machine is having the stepper motors. please mail me the solution by mail, my mail id is email@example.com