Program CNCs

Program CNCs

Xun Xu (University of Auckland, NZ)
DOI: 10.4018/978-1-59904-714-0.ch009
OnDemand PDF Download:


A CNC machine can be programmed in different ways to machine a workpiece. In addition to creating the cutting program, many other factors also need to be considered or programmed. These include workholding devices, cutting tools, machining conditions as well as the machining strategy. The first generation CNCs were programmed manually and punched tapes were used as a medium for transferring the machine control data (MCD), that is, G-codes into a controller. Tapes were later replaced by RS232 cables, floppy disks, and finally standard computer network cables. Today’s CNC machines are controlled directly from files created by CAD/CAM or CAM software packages, so that a part or assembly can go directly from design to manufacturing without the need of producing a drafted paper drawing of the component. This means that for the first time, bringing design and manufacturing under the same automation regime becomes a reachable target. Error detection features give CNC machines the ability to alert the operator in different ways including giving a ring to the operation’s mobile phone if it detects that a tool has broken. While the machine is awaiting replacement on the tool, it would run other parts that are already loaded up to that tool and wait for the operator. The focus of this chapter is on a detailed account of the basics of CNC programming, and the emphasis is on G-code and Automatic Programming Tool (APT). G-code is still the dominant manual programming language for CNC machine tools. It is also the main form of control commands many CAD/CAM (or CAM) systems output. APT was developed soon after G-codes and CNC machine tools were developed to alleviate the drudgery work of straight G-code programming. Modern CAD/CAM systems these days are now becoming the main-stream tools for CNC programming.
Chapter Preview

Program Basics

Today’s full-blown machining centres allow the programmer to control just about any function required through programmed commands. This section lists the things that the programmer can usually control within a program. Also explained is how each function is controlled. The MCD format discussed here conforms to ISO 6983-1 (1982).

Program Format

The CNC machine program is structured in blocks of data. A fixed set of alphabetic, numeric and special characters is used. Any characters that are not to be processed are included within parenthesis. Characters “:” or “%” can be used for display purposes. To identify a machine program, an identifier may be placed immediately after the program start character and before the first “end of block” character.

A block of data consists of a sequence number word and one or more than one data words (also known as NC words). Tab characters, which are optional for the tabulation of a printed copy of the data, may be inserted between words but are usually ignored by the control system. A data word always starts with an address character. The characters are usually presented in the following sequence and are not repeated within one block,

  • Preparatory words “G”;

  • “Dimension” words. These words are arranged in the following sequence: X, Y, Z, U, V, W, P, Q, R, A, B, C;

  • “Interpolation or thread cutting lead words” I, J and K;

  • “Feed function (F)” word;

  • “Spindle speed function (S)” word;

  • “Tool function (T)” word; and

  • “Miscellaneous function (M)” words.

Some words may be omitted in a specific block of data, indicating that there is no change in the condition of the machine with respect to the function denoted by the omitted word. This word is named as a “modal” word. Table 1 summarises the address characters commonly used in a modal word.

Table 1.
Commonly used address characters
AAngular dimension about X axis
BAngular dimension about Y axis
CAngular dimension about Z axis
DSecond tool function
ESecond feed function
FFirst feed function
GPreparatory function
IInterpolation parameter of thread lead parallel to X
JInterpolation parameter of thread lead parallel to Y
KInterpolation parameter of thread lead parallel to Z
MMiscellaneous function
NSequence number
PTertiary dimension parallel to X or parameter
QTertiary dimension parallel to Y or parameter
RTertiary dimension parallel to Z or parameter
SSpindle speed function
TFirst tool function
USecondary dimension parallel to X
VSecondary dimension parallel to Y
WSecondary dimension parallel to Z
XPrimary dimension X
YPrimary dimension Y
ZPrimary dimension Z

Complete Chapter List

Search this Book:
Table of Contents
A.Y.C. Nee
Xun Xu
Chapter 1
Xun Xu
One of the key activities in any product design process is to develop a geometric model of the product from the conceptual ideas, which can then be... Sample PDF
Geometric Modelling and Computer-Aided Design
Chapter 2
Xun Xu
Today, more companies than ever before are involved in manufacturing various parts of their end products using different subcontractors, many of... Sample PDF
CAD Data Exhange and CAD Standards
Chapter 3
Xun Xu
Products and their components are designed to perform certain functions. Design specifi- cations ensure the functionality aspects. The task in... Sample PDF
Computer-Aided Process Planning and Manufacturing
Chapter 4
Feature Technology  (pages 75-89)
Xun Xu
Throughout the course of the development of CAD, CAPP, and CAM systems, unambiguous representation of a design’s geometry and topology remain an... Sample PDF
Feature Technology
Chapter 5
Feature Recognition  (pages 90-108)
Xun Xu
Conventional CAD models only provide pure geometry and topology for mechanical designs such as vertices, edges, faces, simple primitives, and the... Sample PDF
Feature Recognition
Chapter 6
Feature Interactions  (pages 109-125)
Xun Xu
Feature interaction tends to have a wide range of consequences and effects on a feature model and its applications. While these may often be... Sample PDF
Feature Interactions
Chapter 7
Xun Xu
Integrated feature technology promotes a closer connection between design and manufacturing through features. When machining features are... Sample PDF
Integrated Feature Technolog
Chapter 8
CNC Machine Tools  (pages 165-187)
Xun Xu
The introduction of CNC machines has radically changed the manufacturing industry. Curves are as easy to cut as straight lines, complex 3-D... Sample PDF
CNC Machine Tools
Chapter 9
Program CNCs  (pages 188-229)
Xun Xu
A CNC machine can be programmed in different ways to machine a workpiece. In addition to creating the cutting program, many other factors also need... Sample PDF
Program CNCs
Chapter 10
Xun Xu
Technologies concerning computer-aided design, process planning, manufacturing and numerical control, have matured to a point that commercialized... Sample PDF
Integration of CAD/CAPP/CAM/CNC
Chapter 11
Xun Xu
The integration model (Model B) as discussed in the previous chapter makes use of exchangeable neutral data formats such as IGES (1980). Neutral... Sample PDF
Integration Based on STEP Standards
Chapter 12
Xun Xu
Function blocks are an IEC (International Electro-technical Commission) standard for distributed industrial processes and control systems (IEC... Sample PDF
Function Block-Enabled Integration
Chapter 13
Xun Xu
In order to prepare manufacturing companies to face increasingly frequent and unpredictable market changes with confidence, there is a recognized... Sample PDF
Development of an Integrated, Adaptable CNC System
Chapter 14
Xun Xu
A logical step after CNC machining is inspection. With inspections, Closed-Loop Machining (CLM) can be realized to maximize the efficiency of a... Sample PDF
Integrating CAD/CAPP/CAM/CNC with Inspections
Chapter 15
Xun Xu
Today, companies often have operations distributed around the world, and production facilities and designers are often in different locations.... Sample PDF
Internet-Based Integration
Chapter 16
Xun Xu
Companies that have been practicing CAD, CAPP, CAM, and CNC integration have now realized that there is a need to operate in a much broader scope... Sample PDF
From CAD/CAPP/CAM/CNC to PDM, PLM and Beyond
Chapter 17
Key Enabling Technologies  (pages 354-393)
Xun Xu
While computers have proven to be instrumental in the advancement of product design and manufacturing processes, the role that various technologies... Sample PDF
Key Enabling Technologies
About the Author