Key CNC Concept #1—The Fundamentals Of CNC

Though the thrust of this presentation is to teach you CNC usage, it helps to understand why these sophisticated machines have become so popular. Here are but a few of the more important benefits offered by CNC equipment.


Facebook Share Icon LinkedIn Share Icon Twitter Share Icon Share by EMail icon Print Icon

This is the first article in a 10 part series about the Key Concepts of Computer Numerical Control. For an introduction to the approach of this series read this article.

The first benefit offered by all forms of CNC machine tools is improved automation. The operator intervention related to producing workpieces can be reduced or eliminated. Many CNC machines can run unattended during their entire machining cycle, freeing the operator to do other tasks. This gives the CNC user several side benefits including reduced operator fatigue, fewer mistakes caused by human error, and consistent and predictable machining time for each workpiece. Since the machine will be running under program control, the skill level required of the CNC operator (related to basic machining practice) is also reduced as compared to a machinist producing workpieces with conventional machine tools.

The second major benefit of CNC technology is consistent and accurate workpieces. Today's CNC machines boast almost unbelievable accuracy and repeatibility specifications. This means that once a program is verified, two, ten, or one thousand identical workpieces can be easily produced with precision and consistency.

A third benefit offered by most forms of CNC machine tools is flexibility. Since these machines are run from programs, running a different workpiece is almost as easy as loading a different program. Once a program has been verified and executed for one production run, it can be easily recalled the next time the workpiece is to be run. This leads to yet another benefit, fast change-overs.

Since these machines are very easy to set up and run, and since programs can be easily loaded, they allow very short setup time. This is imperative with today's just-in-time production requirements.

Motion Control—The Heart Of CNC

The most basic function of any CNC machine is automatic, precise, and consistent motion control. All forms of CNC equipment have two or more directions of motion, called axes. These axes can be precisely and automatically positioned along their lengths of travel. The two most common axis types are linear (driven along a straight path) and rotary (driven along a circular path).

Instead of causing motion by manually turning cranks and handwheels as is required on conventional machine tools, CNC machines allow motions to be actuated by servomotors under control of the CNC, and guided by the part program. Generally speaking, the motion type (rapid, linear, and circular), the axes to move, the amount of motion and the motion rate (feed rate) are programmable with almost all CNC machine tools. Figure 1 shows the motion control of a conventional machine tool. Figure 2 shows the makeup of a linear axis of a CNC machine.

A CNC command executed within the control (commonly through a program) tells the drive motor to rotate a precise number of times. The rotation of the drive motor in turn rotates the ballscrew. And the ballscrew drives the linear axis. A feedback device at the opposite end of the ballscrew allows the control to confirm that the commanded number of rotations has taken place.

Though a rather crude analogy, the same basic linear motion can be found on a common table vise. As you rotate the vise crank, you rotate a leadscrew that, in turn, drives the movable jaw on the vise. By comparison, a linear axis on a CNC machine tool is extremely precise. The number of revolutions of the axis drive motor precisely controls the amount of linear motion along the axis.

How Axis Motion Is Commanded—Understanding Coordinate Systems

It would be unfeasible for the CNC user to cause axis motion by trying to tell each axis drive motor how many times to rotate in order to command a given linear motion amount. (This would be like having to figure out how many turns of the handle on a table vise will cause the movable jaw to move exactly one inch!) Instead, all CNC controls allow axis motion to be commanded in a much simpler and more logical way by utilizing some form of coordinate system. The two most popular systems used with CNC machines are the rectangular—or "cartesian"—coordinate system and the polar coordinate system. By far, the most common is the rectangular coordinate system, and we'll use it for all discussions made during this presentation.

One very common application for the rectangular coordinate system is graphing. Almost everyone has had to make or interpret a graph. Since the need to utilize graphs is so commonplace, and since it closely resembles what is required to cause axis motion on a CNC machine, let's review the basics of graphing.

Figure 3 is a graph of a company's productivity for last year. As with any two-dimensional graph, this graph has two base lines. Each base line is used to represent something. What the base line represents is broken into increments. Also, each base line has limits. In our productivity example, the horizontal base line is being used to represent time. For this base line, the time increment is in months. Notice this base line has limits—it starts with January and ends with December. The vertical base line represents productivity. Productivity is broken into ten percent increments and starts at zero percent productivity and ends with one hundred percent productivity.

The person making the graph would look up the company's productivity for January of last year and at the productivity position on the graph for January, a point is plotted. This would then be repeated for February, March, and each month of the year. Once all points are plotted, a line or curve can be drawn through each of the points to make it more clear as to how the company did last year.

Let's take what we now know about graphs and relate it to CNC axis motion. Instead of plotting theoretical points to represent conceptual ideas, the CNC programmer is going to be plotting physical end points for axis motions. Each linear axis of the machine tool can be thought of as like a base line of the graph. Like graph base lines, axes are broken into increments. But instead of being broken into increments of conceptual ideas like time and productivity, each linear axis of a CNC machine's rectangular coordinate system is broken into increments of measurement. In the inch mode, the smallest increment may be 0.0001 inch. In the metric mode, the smallest increment may be 0.001 millimeter. (By the way, for rotary axis the increment is 0.001

Just like the graph, each axis within the CNC machine's coordinate system must start somewhere. With the graph, the horizontal base line started at January and the vertical base line started at zero-percent productivity. This place where the vertical and horizontal base lines come together is called the origin point of the graph. For CNC purposes, this origin point is commonly called the program zero point (also called work zero, part zero, or program origin).

Figure 4 shows how axis motions are commonly commanded on CNC machines. For this example, the two axes we happen to be showing are labelled as X and Y, but keep in mind that program zero can be applied to any axis. Though the name of each axis will change from one CNC machine type to another (other common names include Z, A, B, C, U, V, and W), this example should work nicely to show you how axis motion can be commanded.

As you can see, the lower left hand corner of the workpiece has been made to correspond to the zero position for each axis. That is, the lower left-hand corner of the workpiece is the program zero point. Prior to writing the program, the programmer determines the position of the program zero point. Typically, the program zero point is chosen as the point where all dimensions begin.

With this technique, if the programmer wishes the tool to be sent to a position one inch to the right of the program zero point, X1.0 is commanded. If the programmer wishes the tool to move to a position one inch above the program zero point, Y1.0 is commanded. The control will automatically determine how many times to rotate each axis drive motor and ballscrew to make the axis reach the commanded destination point. This lets the programmer command axis motion in a very logical manner.

With the examples given so far, all points happened to be up and to the right of the program zero point. This area up and to the right of the program zero point is called a quadrant (in this case, quadrant number one). It is not uncommon on CNC machines that end points needed within the program fall in other quadrants. When this happens, at least one of the coordinates must be specified as minus. Figure 5 shows the relationship of the four quadrants as well as the plus and minus representations required for each. Figure 6 shows one common application of when end points fall in all four quadrants and negative coordinates must be specified.

Absolute Versus Incremental Motion

All discussions to this point assume that the absolute mode of programming is used. In the absolute mode, the end points for all motions will be specified from the program zero point. For beginners, this is usually the best and easiest method of specifying end points for motion commands. However, there is another way of specifying end points for axis motion.

In the incremental mode, end points for motions are specified from the tool's current position, not from program zero. With this method of commanding motion, the programmer must always be asking, "How far should I move the tool?" While there are times when the incremental mode can be very helpful, generally speaking, this is the more cumbersome and difficult method.

Be careful when making motion commands. Beginners have the tendency to think incrementally. If working in the absolute mode (as beginners should), the programmer should always be asking "To what position should the tool be moved?" This position is relative to program zero, not from the tool's current position. Figure 7 shows two identical series of movements, one in the incremental mode and the other in the absolute mode.

Absolute Versus Incremental Motion

Aside from making it very easy to determine the current position for any command, another benefit of working in the absolute mode has to do with mistakes made during motion commands. In the absolute mode, if a motion mistake is made in one command of the program, only one movement will be incorrect. On the other hand, if a mistake is made during incremental movements, all motions from the point of the mistake will also be incorrect.

Assigning Program Zero

Keep in mind that the CNC control must be told the location of the program zero point by one means or another. How this is done varies dramatically from one CNC machine and control to another. An older method is to assign program zero in the program. With this method, the programmer tells the control how far it is from the program zero point to the starting position of the machine. This is commonly done with a G92 (or G50) command at least at the beginning of the program and possibly at the beginning of each tool.

A newer and better way to assign program zero is through some form of offset. Machining center control manufacturers commonly call offsets used to assign program zero fixture offsets. Turning center manufacturers commonly call offsets used to assign program zero for each tool geometry offsets. More on how program zero can be assigned will be presented during key concept number four.

Other Points About Axis Motion

To this point, our primary concern has been to show you how to determine the end point of each motion command. As you have seen, doing this requires an understanding of the rectangular coordinate system. However, there are other concerns about how a motion will take place. For example, the type of motion (rapid, straight line, circular, etc.), and motion rate (feed rate) will also be of concern to the programmer. We'll discuss these other considerations during key concept number three.

The CNC Program

Almost all current CNC controls use a word address format for programming. (The only exceptions to this are certain conversational controls.) By word address format, we mean that the CNC program is made up of sentence-like commands. Each command is made up of CNC words, each of which has a letter address and a numerical value. The letter address (X, Y, Z, etc.) tells the control the kind of word and the numerical value tells the control the value of the word. Used like words and sentences in the English language, words in a CNC command tell the CNC machine what it is we wish to do at the present time.

One very good analogy to what happens in a CNC program is found in any set of step-by-step instructions. Say, for example, you have some visitors coming in from out of town to visit your company. You need to write down instructions to get from the local airport to your company. To do so, you must first be able to visualize the path from the airport to your company. You will then, in sequential order, write down one instruction at a time. The person following your instructions will perform the first step and then go on to the next until he or she reaches your facility.

In similar manner, a manual CNC programmer must be able to visualize the machining operations that are to be performed during the execution of the program. Then, in step-by-step order, the programmer will give a set of commands that makes the machine behave accordingly.

Though slightly off the subject at hand, we wish to make a strong point about visualization. Just as the person developing travel directions must be able to visualize the path taken, so must the CNC programmer be able to visualize the movements the CNC machine will be making before a program can be successfully developed. Without this visualization ability, the programmer will not be able to develop the movements in the program correctly. This is one reason why machinists make the best CNC programmers. An experienced machinist should be able to easily visualize any machining operation taking place.

Just as each concise travel instruction will be made up of one sentence, so will each instruction given within a CNC program be made up of one command. Just as the travel instruction sentence is made up of words (in English), so is the CNC command made up of CNC words (in CNC language).

The person following your set of travel instructions will execute them explicitly. If you make a mistake with your set of instructions, the person will get lost on the way to your company. In similar fashion, the CNC machine will execute a CNC program explicitly. If there is a mistake in the program, the CNC machine will not behave correctly.

At right is a short example program that drills two holes in a workpiece on a CNC machining center. Keep in mind that we are not stressing the actual commands in this program (though the messages in parentheses should make it relatively clear as to what is happening in each command). Instead, we are stressing the structure of a CNC program and the fact that it will be executed sequentially.

While the words and commands in this program probably do not make much sense to you (yet), remember that we are stressing the sequential order by which the CNC program will be executed. The control will first read, interpret and execute the very first command in the program. Only then will it go on to the next command. Read, interpret, execute. Then on to the next command. The control will continue to execute the program in order for the balance of the program. Again, notice the similarity to giving any set of step-by-step instructions.

Other Notes About Program Makeup

As stated, programs are made up of commands and commands are made up of words. Each word has a letter address and a numerical value. The letter address tells the control the word type. CNC control manufacturers do vary with regard to how they determine word names (letter addresses) and their meanings. The beginning CNC programmer must reference the control manu-facturer's programming manual to determine the word names and meanings. Here is a brief list of some of the word types and their common letter address specifications.

O - Program number (Used for program identification)
N - Sequence number (Used for line identification)
G - Preparatory function (See below)
X - X-axis designation
Y - Y-axis designation
Z - Z-axis designation
R - Radius designation
F - Feedrate designation
S - Spindle speed designation
H - Tool length offset designation
D - Tool radius offset designation
T - Tool Designation
M - Miscellaneous function

As you can see, many of the letter addresses are chosen in a logical manner (T for tool, S for spindle, F for feed rate, etc.). A few require memorizing.

There are two letter addresses (G and M) which allow special functions to be designated. The preparatory function (G) specifies is commonly used to set modes. We already introduced absolute mode, which is specified by G90 and incremental mode, specified by G91. These are but two of the preparatory functions used. You must reference your control manufacturer's manual to find the list of functions for your machine.

Like preparatory functions, miscellaneous functions (M words) allow a variety of special functions. Miscellaneous functions are typically used as programmable switches (like spindle on/off, coolant on/off, and so on). They are also used to allow programming of many other programmable functions of the CNC machine tool.

To a beginner, all of this may seem like CNC programming requires a great deal of memorization. But rest assured that there are only about 30-40 different words used with CNC programming. If you can think of learning CNC manual programming as like learning a foreign language that has only 40 words, it shouldn't seem too difficult.

Decimal point programming

Certain letter addresses (CNC words) allow the specification of real numbers (numbers that require portions of a whole number). Examples include X-axis designator (X), Y-axis designator (Y), and radius designator (R). Almost all current model CNC controls allow a decimal point to be used within the specification of each letter address. For example, X3.0625 can be used to specify a position along the X axis.

On the other hand, some letter addresses are used to specify integer numbers. Examples include the spindle speed designator (S), the tool station designator (T), sequence numbers (N), preparatory functions (G), and miscellaneous functions (M). For these word types, most controls do not allow a decimal point to be used. The beginning programmer must reference the CNC control manufacturer's programming manual to find out which words allow the use of a decimal point.

Other programmable functions

All but the very simplest CNC machines have programmable functions other than just axis motion. With today's full blown CNC equipment, almost everything about the machine is programmable. CNC machining centers, for example, allow the spindle speed and direction, coolant, tool changing, and many other functions of the machine to be programmed. In similar fashion, CNC turning centers allow spindle speed and direction, coolant, turret index, and tailstock to be programmed. And all forms of CNC equipment will have their own set of programmable functions. Additionally, certain accessories like probing systems, tool length measuring systems, pallet changers, and adaptive control systems may also be available and will require programming considerations.

The list of programmable functions will vary dramatically from one machine to the next, and the user must learn these programmable functions for each CNC machine to be used. In key concept number two, we will take a closer look at what is typically programmable on different forms of CNC machine tools.