Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
15 views

Computer Numerical Control Workshop

Uploaded by

jojoahma7
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views

Computer Numerical Control Workshop

Uploaded by

jojoahma7
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 23

Computer Numerical Control Workshop

Objectives:
To understand the working principle & applications of CNC machines.
To understand the structure & flow of a CAM system.
To understand the applications of CNC machines.
This workshop provides an introductory treatment of automation technology & the components that
make up an automated system. Also, two important automation technologies used in manufacturing are
described: numerical control mainly & industrial robotics.
Automation Fundamentals
Automation can be defined as the technology by which a process or procedure is performed without
human assistance. Humans may be present as observers or even participants, but the process itself
operates under its own self-direction.
Three Components of An Automated System
An automated system consists of three basic components:
(1) Power
(2) A program of instructions
(3) A control system to conduct the instructions
The form of power used in most automated systems is electrical. The advantages of electrical power are:
(1) It is widely available.
(2) It can be readily converted to other forms of power such as mechanical, thermal, or hydraulic.
(3) It can be used at extremely low power levels for functions such as signal processing, communication,
data storage, & data processing.
(4) It can be stored in long-life batteries.
Power is also used to accomplish any material handling activities needed in the process, such as
loading & unloading parts, if these activities are not performed manually. Finally, power is needed to
operate the control system.
The activities in an automated process are determined by a program of instructions. In the simplest
automated processes, the only instruction may be to maintain a certain controlled variable at a specified
level. In more complex processes, a sequence of activities is required during the work cycle, & the order
& details of each activity are defined by the program of instructions.
Each activity involves changes in one or more process parameters, such as changing the x-coordinate
position of a machine tool worktable, opening or closing a valve in a fluid flow system, or turning a motor
on or off. Process parameters are inputs to the process. They may be continuous (continuously variable
over a given range, such as the x-position of a worktable) or discrete (on or off). Examples include the
actual position of the machine worktable, the rotational speed of a motor shaft, or whether a warning
light is on or off. The program of instructions specifies the changes in process parameters & when they
should occur during the work cycle, & these changes determine the resulting values of the process
variables. For example, in computer numerical control, the program of instructions is called a part
program. It specifies the individual steps required to machine a given part, including worktable & cutter
positions, cutting speeds, feeds, & other details of the operation.
In some automated processes, the work cycle program must contain instructions for making decisions or
reacting to unexpected events during the work cycle.

(a)

(b)
Figure 1: Two basic types of control systems: (a) closed loop & (b) open loop.
Examples of situations requiring this kind of capability include:
(1) Interactions & communications with humans such as responding to requests for system status info.
(2) Safety monitoring requirements
The program of instructions is executed by a control system, the third basic component of an
automated system. Two types of control system can be distinguished: closed loop & open loop. A
closed-loop system, also known as a feedback control system, is one in which the process variable
of interest (output of the process) is compared with the corresponding process parameter (input to
the process), & any difference between them is used to drive the output value into agreement with
the input. Figure 1 (a) shows the six elements of a closed-loop system: (1) input parameter, (2)
process, (3) output variable, (4) feedback sensor, (5) controller, & (6) actuator.
The input parameter represents the desired value of the output variable. The process is the operation
or activity being controlled; more specifically, the system is controlling the output variable. A sensor is
used to measure the output variable & feedback its value to the controller, which compares output with
input & makes the required adjustment to reduce any difference. The adjustment is made by means of
actuators, hardware devices that physically accomplish the control actions.
The other type of control system, shown in Figure 1 (b), is an open-loop system, which executes the
program of instructions without a feedback loop. No measurement of the output variable is made, so
there is no comparison between output & input in an open-loop system. In effect, the controller relies on
the expectation that the actuator will have the intended effect on the output variable. Thus, there is
always a risk in an open-loop system that the actuator will not function properly or that its actuation
will not have the expected effect on the output. On the other hand, the advantage of an open-loop
system is that its cost is less than a comparable closed-loop system.
Hardware for Automation
Automation & process control is implemented using various hardware devices that interact with the
production operation & associated processing equipment. Sensors are required to measure the
process variables. Actuators are used to drive the process parameters. & various additional devices
are needed to interface the sensors & actuators with the process controller, which is usually a digital
computer.
Sensors
A sensor is a device that converts a physical stimulus or variable of interest (e.g., temperature, force,
pressure, or other characteristic of the process) into a more convenient physical form (e.g., electrical
voltage) for the purpose of measuring the variable. The conversion allows the variable to be
interpreted as a quantitative value.
Sensors of several types are available to collect data for feedback control in manufacturing
automation. They are often classified according to type of stimulus; thus, there are mechanical,
electrical, thermal, radiation, magnetic, & chemical variables. For example, within the mechanical
category, the physical variables include position, velocity, force, & torque. Electrical variables include
voltage, current, & resistance, & so on for the other major categories.
In addition to the type of stimulus, sensors are also classified as analog or discrete.
Before a measuring device can be used, it must be calibrated, which means determining how the
value of the stimulus is related to the value of the output signal. Ease of calibration is one criterion by
which a measuring device can be selected. Other criteria include accuracy, precision, operating range,
speed of response, reliability, & cost.
Actuators
In automated systems, an actuator is a device that converts a control signal into a physical action,
which usually refers to a change in a process input parameter. The action is typically mechanical,
such as a change in position of a worktable or rotational speed of a motor. The control signal is
generally a low-level signal, & an amplifier may be required to increase the power of the signal to drive
the actuator. Actuators can be classified according to type of amplifier as:
(1) Electrical.
(2) Hydraulic.
(3) Pneumatic.
Electrical actuators include AC & DC electric motors, stepper motors, & solenoids. Hydraulic
actuators utilize hydraulic fluid to amplify the control signal & are often specified when large forces
are required in the application. Pneumatic actuators are driven by compressed air, which is commonly
used in factories. All three actuator types are available as linear or rotational devices. This designation
distinguishes whether the output action is a linear motion or a rotational motion. Electric motors &
stepper motors are more common as rotational actuators, whereas most hydraulic & pneumatic
actuators provide a linear output.
Interface Devices
Interface devices allow the process to be connected to the computer controller & vice versa.
Sensor signals from the manufacturing process are fed into the computer, & command signals are
sent to actuators that operate the process. Continuous analog signals from sensors attached to the
process must be transformed into digital values that can be used by the control computer, a function
accomplished by an analog-to-digital converter (ADC).
Contact input/output interfaces are components used to communicate binary data back & forth
between the process & the control computer. A contact input interface is a device that reads binary
data into the computer from an external source. It consists of a series of binary electrical contacts that
indicate the statuses of binary devices attached to the process. The status of each contact is
periodically scanned by the computer to update values used by the control program. A contact
output interface is a device used to communicate on/off signals from the computer to external
binary components such as solenoids, alarms, & indicator lights.
As mentioned earlier, discrete data sometimes exists in the form of a series of pulses. For example,
an optical encoder emits its measurement of position & velocity as a series of pulses.

(a) (b)

Figure 2: Optical encoder: (a) Apparatus & (b) Series of pulses emitted to measure rotation of disk.
Process Controllers
Most process control systems use some type of digital computer as the controller. Whether control
involves continuous or discrete parameters & variables, or a combination of continuous & discrete, a
digital computer can be connected to the process to communicate & interact with it using the interface
devices discussed.
A widely used process controller that satisfies these requirements is a programmable logic controller.
A programmable logic controller (PLC) is a microcomputer-based controller that uses stored
instructions in programmable memory to implement logic, sequencing, timing, counting, & arithmetic
control functions, through digital or analog input/output modules, for controlling various machines &
processes.
Computer Numerical Control
Numerical control (NC) is a form of programmable automation in which the mechanical actions of a
piece of equipment are controlled by a program containing coded alphanumeric data. The data rep-
resent relative positions between a work head & a work part. The work head is a tool or other pro-
cessing element, & the work part is the object being processed.
The operating principle of NC is to control the motion of the work head relative to the work part & to
control the sequence in which the motions are carried out. The first application of numerical control
was in machining & this is still an important application area.
Computer Numerical Control (CNC) refers to any machine tool (i.e., mill, lathe, drill press, etc.)
which uses a computer to electronically control the motion of one or more axes on the machine. The
functions & motions of a machine tool are controlled by means of a prepared program containing
coded alphanumeric data. The development of NC machine tools started from a task supportedby
the US Air Force in the early 1950’s, involving MIT & several machine-tool manufacturing companies.
The need was recognized for machines to be able to manufacture complex jet aircraft parts.
As computer technology evolved, computers replaced the more inflexible controllers found on the NC
machines, hence the dawn of the CNC era. CNC uses software programs to provide the instructions
necessary to control the axis motions, spindle speeds, tool changes & so on. CNC machine tools
allow multiple axes of motion simultaneously, resulting in 2D & 3D contouring ability & also an
increase in productivity & quality control by allowing multiple parts to be produced using the same
program & tooling. CNC can control the motions of the workpiece or tool, the input parameters such
as feed, depth of cut, speed, & the functions such as turning spindle on/off, turning coolant on/off.
CNC is a specialized & versatile form of Soft Automation & its applications cover many kinds,
although it was initially developed to control the motion & operation of machine tools & it may be
considered to be a means of operating a machine through the use of discrete numerical values fed
into the machine, where the required 'input' technical information is stored on a kind of input media
such as floppy disk, hard disk, CD ROM, DVD, USB flash drive, or RAM card etc.
The machine follows a predetermined sequence of machining operations at the predetermined
speeds necessary to produce a workpiece of the right shape & size & thus according to completely
predictable results. A different product can be produced through reprogramming & a low-quantity
production run of various products is justified.
The definition of CNC given by Electronic Industry Association is “A system in which actions are
controlled by the direct insertion of numerical data at some point. The system must automatically
interpret at least some portion of this data. In a simple word, a CNC system receives numerical data,
interpret the data & then control the action accordingly.”
Applications
The applications of CNC include both for machine tool as well as non-machine tool areas. In the
machine tool category, CNC is widely used for lathe, drill press, milling machine, grinding unit,
laser, sheet-metal press working Machining, tube bending machine etc. Highly automated machine
tools such as turning center & machining center which change the cutting tools automatically
under CNC control have been developed.
Advantages & Limitations
The benefits of CNC are:
(1) H igh accuracy in manufacturing
(2) Short production time
(3) Greater manufacturing flexibility
(4) S impler fixturing
(5) C ontour machining (2 to 5 -axis machining)
(6) R educed human error
The drawbacks include:
(1) Excessive cost
(2) Maintenance
(3) The requirement of skilled part programmer
The Technology of Numerical Control
This section defines the components of a numerical control system & describes the coordinate axis
system & motion controls.
Components of an NC System
A numerical control system consists of three basic components:
(1) Part program
(2) Machine control unit
(3) Processing equipment
The part program (this is the term used in machine tool technology) is the detailed set of commands
to be followed by the processing equipment. It is the program of instructions in the NC control system.
Each command specifies a position or motion that is to be accomplished by the work head relative to
the work part. A position is defined by its x-y-z coordinates. In machine tool applications, additional
details in the NC program include spindle rotation speed, spindle direction, feed rate, tool change
instructions, & other commands related to the operation. The part program is prepared by a part
programmer, a person who is familiar with the details of the programming language & also
understands the technology of the processing equipment.
The machine control unit (MCU) is the heart of the CNC system. There are two subunits in the
machine control unit: the Data Processing Unit (DPU) and the Control Loop Unit (CLU).
MCU in modern NC technology is a microcomputer that stores & executes the program by converting
each command into actions by the processing equipment, one command at a time. The MCU consists
of both hardware & software. The hardware includes the microcomputer, components to interface with
the processing equipment, & certain feedback control elements. The software in the MCU includes
control system software, calculation algorithms, & translation software to convert the NC part
program into a usable format for the MCU. The MCU also permits the part program to be edited in
case the program contains errors, or changes in cutting conditions are required. Because the MCU is
a computer, the term computer numerical control (CNC) is often used to distinguish this type of
NC from its technological predecessors that were based entirely on hard-wired electronics. The
processing equipment accomplishes the sequence of processing steps to transform the starting work
part into a completed part. It operates under the control of the MCU according to the instructions in
the part program.
a. Data Processing Unit
On receiving a part program, the DPU first interprets and encodes the part program into internal
machine codes. The interpolator of the DPU then calculates the intermediate positions of the motion
in terms of BLU (basic length unit) which is the smallest unit length that can be managed by the
controller. The calculated data is passed to CLU for further action.
b. Control Loop Unit
The data from the DPU are converted into electrical signals in the CLU to control the driving system
to perform the required motions. Other functions such as machine spindle ON/OFF, coolant ON/OFF,
tool clamp ON/OFF are also controlled by this unit according to the internal machine codes.

Figure 3: A typical numerical control system for a milling machine.


Coordinate System & Motion Control in NC
A standard coordinate axis system is used to specify positions in numerical control. It consists of
the three linear axes (x, y, z) plus three rotational axes (a, b, c), as shown in figure 4(a). The
rotational axes are used to rotate the work part to present different surfaces for machining, or to
orient the tool or work head at some angle relative to the part. Most NC systems do not require all
six axes. The simplest NC systems (e.g., pressworking machines for flat sheet metal stock, &
component placement machines) are positioning systems whose locations can be defined in an x-y
plane. Programming of these machines involves specifying a sequence of x-y coordinates. By contrast,
some machine tools have five-axis control to create complex work part geometries. These systems
typically include three linear axes plus two rotational axes.
The coordinates for a rotational NC system are illustrated in figure 4(b). These systems are associated
with turning operations on NC lathes. Although the work rotates, this is not one of the controlled axes
in a conventional NC turning system. The cutting path of the tool relative to the rotating workpiece is
defined in the x-z plane, as shown in the figure.

(a) (b)
Figure 4: Coordinate systems used in numerical control: (a) for flat & prismatic work, & (b) for rotational work.
The coordinate systems described above are for basic machines in which one cutting tool is
controlled. Some machines have additional axes to achieve independent control of multiple cutting
tools; for example, CNC mill-turn centers. In many NC systems, the relative movements between the
processing tool & the work part are accomplished by fixing the part to a worktable & then controlling
the positions & motions of the table relative to a stationary or semi-stationary work head. Most
machine tools are based on this method of operation. In other systems, the work part is held stationary
& the work head is moved along 2 or 3 axes. Flame cutters, x-y plotters, & coordinate measuring
machines operate this way.

Figure 5: Schematic illustration of drilling, boring, & milling with various paths.
Interpolator
Another aspect of motion control is concerned with how the positions in the coordinate system are
defined.
The input speed of 0.1 in/sec in example 2 is converted into the velocity components by an interpolator
called the linear interpolator whose function is to provide the velocity signals to x & y directions.
Similarly, we have circular & parabolic interpolators. See figure 6.

(a) (b) (c)


Figure 6. Types of interpolation (a) linear, (b) continuous path approximated by incremental straight lines, (c) circular.
Precision in CNC Machining
The combined characteristics of the machine tool and the control determine the precision of
positioning. Three critical measures of precision are:
 Resolution
 Accuracy
 Repeatability
Control resolution (BLU) is the distance separating two adjacent points in the axis movement (the
smallest change in the position). The electromechanical components of the positioning system that
affect the resolution are the leadscrew pitch, the gear ratio, and the step angle in the stepping motor
(open loop) or the angle between the slots in the encoder (closed loop).
Features smaller than the control resolution could not be produced. The programming resolution
cannot exceed the control resolution.
Accuracy of a CNC system depends on the resolution, the computer control algorithms, and the
machine inaccuracies. The inaccuracy due to the resolution is considered to be (1/2) BLU on
average. The control algorithm inaccuracy is due to the rounding off the errors in the computer which
is insignificant. The machine inaccuracy could be due to several reasons (described below). The
designer minimizes this inaccuracy to be under 0.5 BLU.
Repeatability is a statistical term associated with accuracy. It refers to the capability of a positioning
system to return to a programmed point and is measured in terms of the errors associated with the
programmed point. The repeatability is always better than the accuracy. Mechanical inaccuracy can
be considered as repeatability. Figure 7 shows the difference between accuracy and repeatability.

Low accuracy/ Low repeatability Low accuracy/ High repeatability

Higher accuracy/ High repeatability Lower accuracy/High repeatability

Lower resolution / High repeatability Higher resolution / Lower repeatability


Figure 7: Diagram showing the difference between accuracy, repeatability, and resolution.
Machining Inaccuracy Cutting tool deflection, machine tool chatter, mechanical leadscrew-tool
linkage, and thermal deformations are the chief contributing factors. The leadscrew transmits the
power to the table or tool holder by a nut that engages the leadscrew. This creates "backlash” due to
the friction between the screw and the nut. If the nut consists of ball bearings, the friction is reduced.
Machine Tool
This can be any type of machine tool or equipment. In order to obtain high accuracy and repeatability,
the design and make of the machine slide and the driving leadscrew of a CNC machine is of vital
importance. The slides are usually machined to high accuracy and coated with anti-friction material in
order to reduce the stick and slip phenomenon. Large diameter recirculating ball screws are employed
to eliminate the backlash and lost motion. Other design features such as rigid and heavy machine
structure; short machine table overhang, quick change tooling system, etc. also contribute to the high
accuracy and high repeatability of CNC machines.

(a) (b)
Figure 8: (a) Ball Screw in a CNC machine, (b) Ball screw structure.
Driving System
The driving system is an important component of a CNC machine as the accuracy and repeatability
depend very much on the characteristics and performance of the driving system. The requirement is
that the driving system has to response accurately according to the programmed instructions. This
system usually uses electric motors although hydraulic motors are sometimes used for large machine
tools. The motor is coupled either directly or through a gear box to the machine leadscrew to move the
machine slide or the spindle. Three types of electrical motors are commonly used.
a. DC Servo Motor
This is the most common type of feed motor used in CNC machines. The change of the motor speed
is by varying the armature voltage and the control of motor torque is achieved by controlling the
motor's armature current. In order to achieve the necessary dynamic behavior, it is operated in a
closed loop system equipped with sensors to obtain the velocity and position feedback signals.
b. AC Servo Motor
In an AC servomotor, the rotor is a permanent magnet while the stator is equipped with 3-phase
windings. The speed of the rotor is equal to the rotational frequency of the magnetic field of the stator,
which is regulated by the frequency converter.
AC motors are gradually replacing DC servomotors. The main reason is that there is no commutator or
brushes in AC servomotor so that maintenance is virtually not required. Furthermore, AC servos have
a smaller power-to-weight ratio and faster response.
c. Stepping Motor
A stepping motor is a device that converts the electrical pulses into discrete mechanical rotational
motions of the motor shaft. This is the simplest device that can be applied to CNC machines since it
can convert digital data into actual mechanical displacement. It is not necessary to have any analog-
to-digital converter nor feedback device for the control system. They are ideally suited to open loop
systems.
However, stepping motors are not commonly used in machine tools due to the following drawbacks:
slow speed, low torque, low resolution and easy to slip in case of overload. Examples of stepping
motor application are the magnetic head of floppy-disc drive and hard disc drive of computer, daisy-
wheel type printer, X-Y tape control, and CNC EDM Wire-cut machine.
d. Linear Motor
A linear electric motor is an AC rotary motor laid out flat. The same principle used to produce torque in
rotary motors is used to produce force in linear motors. Through the electromagnetic interaction
between a coil assembly and a permanent magnet assembly, the electrical energy is converted to
linear mechanical energy to generate a linear motion. Linear motors have the advantages of high
speeds, high precision and fast response.
Feedback Device
In order to have a CNC machine operating accurately, the positional values and speed of the axes
need to be constantly updated. Two types of feedback devices are normally used, positional feedback
device and velocity feedback device.
a. Positional Feed Back Devices
There are two types of positional feedback devices: linear transducer for direct positional
measurement and rotary encoder for angular or indirect linear measurement.
Linear Transducers: A linear transducer is a device mounted on the machine table to measure the
actual displacement of the slide in such a way that backlash of screws, motors, etc. would not cause
any error in the feedback data. This device is considered to be of the highest accuracy and also more
expensive in comparison with other measuring devices mounted on screws or motors.
Rotary Encoders: A rotary encoder is a device mounted at the end of the motor shaft or screw to
measure the angular displacement. This device cannot measure linear displacement directly so that
error may occur due to the backlash of screw and motor etc. Generally, this error can be compensated
for by the machine builder in the machine calibration process.
b. Velocity Feedback Device
The actual speed of the motor can be measured in terms of voltage generated from a tachometer
mounted at the end of the motor shaft. DC tachometer is essentially a small generator that produces
an output voltage proportional to the speed. The voltage generated is compared with the command
voltage corresponding to the desired speed. The difference of the voltages can be then used to
actuate the motor to eliminate the error.
Display Unit
The Display Unit serves as an interactive device between the machine and the operator. When the
machine is running, the Display Unit displays the present status such as the position of the machine
slide, the spindle RPM, the feed rate, the part programs, etc.
In an advanced CNC machine, the Display Unit can show the graphics simulation of the tool path so
that part programs can be verified before the actually machining. Much other important information
about the CNC system can also be displayed for maintenance and installation work such as machine
parameters, logic diagram of the programmer controller, error messages and diagnostic data.

Figure 9: Display Unit for CNC machines (Courtesy of Heidenhain)


Applications of CNC Machines
Machining is an important application area for numerical control, but the operating principle of NC can
be applied to other operations as well. There are many industrial processes in which the position of a
work head must be controlled relative to the part or product being worked on.
The applications can be divided into two categories:
(1) Machine tool applications
(2) Nonmachine tool applications.
CNC machines are widely used in the metal cutting industry and are best used to produce the
following types of products:
 Parts with complicated contours.
 Parts requiring close tolerance and/or good repeatability.
 Parts requiring expensive jigs and fixtures if produced on conventional machines.
 Parts that may have several engineering changes, such as during the prototype development stage.
 In cases where human errors could be extremely costly.
 Parts that are needed in a hurry.
 Small batch lots or short production runs.
Some common types of CNC machines and instruments used in industry are as following:
 Drilling Machine
 Lathe/Turning Centre Milling/Machining Centre
 Wire cut Electro Discharge Machine (EDM)
 Grinding Machine
 Laser Cutting Machine Water Jet Cutting Machine Electro Discharge Machine
 Coordinate Measuring Machine Industrial Robot
In the machine tool, NC is widely used for machining operations such as turning, drilling, & milling.
The use of NC in these processes has motivated the development of highly automated machine tools
called machining centers, which change their own cutting tools to perform a variety of machining
operations under NC program control.
Elements of a CNC System
A CNC system consists of the following 6 major elements:
1. Input Device
2. Machine Control Unit
3. Machine Tool
4. Driving System
5. Feedback Devices
6. Display Unit

Figure 10: Working principles of CNC Machines.


Input Device
After post processing, the CNC program can be transmitted to the CNC machines either through the
offline or on-line process.
(a) Offline Processes Data carriers are used to transmit the CNC program to the CNC machines. It
includes paper tapes, magnetic tape or magnetic disc.
(b) Online Processes Online processes is commonly used in DNC operation and data is transferred
either serially or parallel using data cables.
Data Transmission
 Floppy Disk Drive
Floppy disk is a small magnetic storage device for CNC data input. It has been the most common
storage media up to the 1970s, in terms of data transfer speed, reliability, storage size, data handling
and the ability to read and write. Furthermore, the data within a floppy could be easily edited at any
point as long as you have the proper program to read it. However, this method has proven to be quite
problematic in the long run as floppies have a tendency to degrade alarmingly fast and are sensitive to
large magnetic fields and as well as the dust and scratches that usually existed on the shop floor.
 USB Flash Drive
A USB flash drive is a removable and rewritable portable hard drive with compact size and bigger
storage size than a floppy disk. Data stored inside the flash drive is impervious to dust and scratches
that enable flash drives to transfer data. In recent years, all computers support USB flash drives to
read and write data that make it become more popular in CNC machine control unit.

(a) (b)

(c) (d)
Figure 11: (a) Floppy Disk Drive on a CNC machine, (b) USB Flash Drive on a CNC machine,
(c) Serial communication, (d) Ethernet communication
 Serial communication
The data transfer between a computer and a CNC machine tool is often accomplished through a serial
communication port. Part programs can be downloaded into the memory of a machine tool or
uploaded to the computer for temporary storage by running a communication program on the
computer and setting up the machine control to interact with the communication software.
Direct Numerical Control is referred to a system connecting a set of numerically controlled machines to
a common memory for part program or machine program storage with provision for on-demand
distribution of data to the machines.
The host computer is linked with a number of CNC machines or computers connecting to the CNC
machines for downloading part programs. The communication program in the host computer can
utilize two-way data transfer features for production data communication including production
schedule, parts produced and machine utilization etc.
 Ethernet communication
Due to the advancement of the computer technology and the drastic reduction of the cost of the
computer, it is becoming more practical and economic to transfer part programs between computers
and CNC machines via an Ethernet communication cable. This media provides a more efficient and
reliable means in part program transmission and storage. Most companies now built a Local Area
Network (LAN) as their infrastructure. More and more CNC machine tools provide an option of the
Ethernet Card for direct communication within the LAN.
 Parallel Transmission
Parallel transmission is commonly used in data transmission between computers and external devices
such as sensors, programmable logic controllers (PLC) or actuators.
 Local Area Networks
To enable the CAD/CAM facilities to run smoothly, it is desirable for the facilities to be linked together.
In the local-area network, terminals can access any computer on the network or devices on the shop
floor without a physical hardwire. The design of software enables controls of data handling and error
recovery, while hardware generates and receives signals, and media that carries the signals.
Machine Control Unit
The machine control unit (MCU) is a microcomputer that stores the program & executes the
commands into actions by the machine tool. The MCU consists of two main units: the data processing
unit (DPU) & the control loops unit (CLU). The DPU software includes control system software,
calculation algorithms, translation software that converts the part program into a usable format for the
MCU, interpolation algorithm to achieve smooth motion of the cutter, editing of part program (in case of
errors & changes). The DPU processes the data from the part program & provides it to the CLU which
operates the drives attached to the machine leadscrews & receives feedback signals on the actual
position & velocity of each one of the axes. A driver (DC motor) & a feedback device are attached to
the leadscrew. The CLU consists of the circuits for position & velocity control loops, deceleration &
backlash take up, function controls such as spindle on/off.
Machine Tool
The machine tool could be a lathe, milling machine, laser, plasma, coordinate measuring machine etc.
Figure 12 shows that a right-hand coordinate system is used to describe the motions of a machine
tool. There are three linear axes (x, y, z), three rotational axes (i, j, k), & other possible axes such as tilt
(θ). For example, a 5-axis machine implies any combination of x, y, z, i, j, k, & θ.

Figure 12: Right-hand coordinate system used in drill press & lathe.
Facts about CNC Machining
• CNC manufacturing offers advantages on two types of parts:
(1) Simple parts that are mass produced and/or (2) Complex parts with features requiring multiple
axes of simultaneous motion. For low quantity simple parts, it is often quicker to produce the parts on
manual machines (as in lab).
• CNC does not inherently imply increased part accuracy. An old CNC with a lot of hours of use will
produce less accurate features than a new quality manual machine and vice versa; so, don’t
automatically associate higher accuracy with CNC machines. (Accuracy has more to do with machine
design, component selection and mechanical wear).
• Modern CNC machines offer increased productivity due to stiffer machine and spindle designs,
more powerful motors, high pressure coolant (up to 1000 psi) that floods the cutting zone, automatic
tool changers, digital workpiece and tool probing, and/or horizontally mounted spindles.
• Downsides to CNC machines are higher initial cost, larger space and electrical requirements,
increased maintenance cost, required programming skillset and their inherent complexity means
there’s a higher probably of component failure during the useful lifespan.
PART PROGRAMMING FOR NC/CNC
The transfer of an engineering blueprint of a product to a part program can be performed manually
using a calculator or with the assistance of a computer language. A part programmer must have an
extensive knowledge of the machining processes & the capabilities of the machine tools. In this
section, we describe how the part programmers execute manually the part programs. In machine tool
applications, the task of programming the system for a given part is usually accomplished by someone
familiar with the metalworking process who has learned the programing procedure for the particular
equipment in the plant. Computer systems are used extensively in NC part programing. Part
programing requires the programmer to define the points, lines, & surfaces of the work part in the axis
system, & to control the movement of the cutting tool relative to these defined part features.
CNC Programming Types
Several part programing techniques are available, the most important of which are:
(1) Manual part programming (conversational programming).
(2) CAD/CAM-assisted part programming.
(3) Manual data input.
1. Manual Part Programming (Conversational Programming)
This is the simplest of the methods.
It is a macro programming language used to instruct the machine to perform preprogrammed cycles
(i.e., facing, drilling holes in arrays, etc.). When writing a conversational program, you simply enter the
appropriate parameters associated with each machining cycle. This is analogous to using the polar
array function in SolidWorks or AutoCAD; you don’t have to do the layout or trig to find the location of
the features; you just specify the essential parameters & the software does the rest for you.
Part programs can be input to the controller via the keyboard. Built-in intelligent software inside the
controller enables the operator to enter the required data step by step.

Figure 13: Manual Part Programming (Conversational Programming) in a CNC controller


For simple point-to-point machining jobs such as drilling operations, manual programing is often the
easiest & most economical method. Manual part programing uses basic numerical data & special
alphanumeric codes to define the steps in the process.
For example, to perform a drilling operation, a command of the following type is entered:
n010 x70.0 y85.5 f175 s500
Each “word” in the statement specifies a detail in the drilling operation. The n-word (n010) is simply a
sequence number for the statement. The x- & y-words indicate the x-and y-coordinate positions (x =
70.0 mm & y = 85.5 mm). The f-word & s-word specify the feed rate & spindle speed to be used in the
drilling operation (feed rate =175 mm/min & spindle speed =500 rev/min). The complete NC part
program consists of a sequence of statements similar to the above command.
2. CAD/CAM-Assisted Part Programming
This is the most powerful of the methods.
Using this method, you import your part model into a CAM (computer aided manufacturing) program
& define the parameters associated with each & every machined feature on the part. These
parameters include tool diameter & length, depth of cut, tool path geometry, etc.
The use of computers in NC part programming has advanced significantly with the development of
computer-aided design & computer-aided manufacturing (CAD/CAM). Before CAD/CAM, part
programming for parts that were too complex to be done manually was accomplished using a textual
language called APT. APT allowed the part programmer to:
(1) Define the geometry of the part by defining its constituent elements (e.g., points, lines, circles).
(2) Specify the tool path to be followed to machine the part using simple motion commands.
The procedure is called computer-assisted part programming. The use of CAD/CAM takes computer-
assisted part programming a step further by using a computer graphics system (CAD/CAM system) to
interact with the programmer as the part program is being prepared. In the conventional use of APT, a
complete program is written & then entered into the computer for processing. Many programming
errors are not detected until computer processing. When a CAD/CAM system is used, the programmer
receives immediate visual verification when each statement is entered, to determine whether the
statement is correct. When part geometry is entered by the programmer, the element is graphically
displayed on the monitor. When the tool path is constructed, the programmer can see exactly how the
motion commands will move the tool relative to the part. Errors can be corrected immediately rather
than after the entire program has been written.
Interaction between programmer & programming system is a significant benefit of CAD/CAM assisted
programming. There are other important benefits as well. First, if the design of the product & its
component parts were created on a CAD/CAM system, the resulting design database, including the
geometric definition of each part, can be retrieved by the NC programmer to use as the starting
geometry for part programming. This retrieval saves considerable time compared to reconstructing the
part from scratch using the APT geometry statements.
Second, special software routines are available in CAD/CAM-assisted part programming to auto-mate
portions of the tool path generation, such as profile milling around the outside periphery of a part,
milling a pocket into the surface of a part, surface contouring, & certain point-to-point operations.
These routines are called by the part programmer as special macro commands. Their use results in
significant savings in programming time & effort.
3. Manual Data Input
Manual data input (MDI) is a method in which a machine operator enters the part program. The
method involves the use of a CRT display with graphics capability at the machine tool controls. NC
part programming statements are entered using a menu-driven procedure that requires minimum
training of the machine operator. Because part programming is simplified & does not require a special
staff of NC part programmers, MDI is a way for small machine shops to economically implement
numerical control in their operations.
CNC Programming Procedures
Firstly, the machining parameters are determined. Then, the optimal sequence of operations is
evaluated. The tool path is calculated & a program is written. Each line of the program, referred to
as a block, contains the required data for transfer from one point to the next.
For the following typical line for a program:
N100 G91 X-5.0 Y7.0 F100 S200 T01 M03 (EOB)
The significance of each term is:
Sequence Number, N
Consisting of typically three digits, its purpose is to identify the specific machining operation
through the block number particularly when testing a part program.
Preparatory Function, G
It prepares the MCU circuits to perform a specific operation. The G-codes (some) are shown in
Table 1. 091 implies incremental mode of operation.
Dimension Words
1. Distance dimension words, X, Y, Z.
2. Circular dimension words, I, J, K for distances to the arc center.
3. Angular dimensions, A, B, C.
While (1) & (3) are expressed either by incremental or absolute mode, (2) is always in given in
incremental mode. All angular dimensions are specified in revolutions or degrees.
In the above block, X moves a distance of 5 in. in the negative direction while Y moves a
distance of 7 in. in the positive direction. Other axes remain stationary. In some systems, actual
distances are used. In others, the dimension words are programmed in BLUs.
Feed rate, F
It is expressed in in/min or mm/min and. is used in contouring or point-to-point or straight-cut
systems. For example, a feed rate of F100 implies 100 in/min or 100 mm/min. feed rates are
independent of spindle speed.
In linear motions, the feed rate of the cutting tool is not corrected for the cutter radius. But in
circular motions, the feed rate should be corrected for the tool radius as follows:
𝐹 = [(𝑝𝑎𝑟𝑡 𝑐𝑜𝑛𝑡𝑜𝑢𝑟 𝑟𝑎𝑑𝑖𝑢𝑠 ± 𝑡𝑜𝑜𝑙 𝑟𝑎𝑑𝑖𝑢𝑠)/𝑝𝑎𝑟𝑡 𝑐𝑜𝑛𝑡𝑜𝑢𝑟 𝑟𝑎𝑑𝑖𝑢𝑠] (𝑟𝑒𝑞𝑢𝑖𝑟𝑒𝑑 𝑓𝑒𝑒𝑑 𝑟𝑎𝑡𝑒) ⋯ ⋯ ⋯ (15)
For cutting around the outside of a circle, the plus sign in the above equation is used, & the feed
rate is increased. For cutting around the inside of a circle, the minus sign is used, & the feed rate
is decreased.
Spindle speed, S Programmed in rev/min, it is expressed as RPM or by a three-digit code
number that is related to the RPM.
Tool word, T Consisting of a maximum of five digits, each cutting tool has a different code
number. The tool is automatically selected by the automatic tool changer when the code
number is programmed in a block.
Miscellaneous Function, M Consisting of two digits, this word relates to the movement of the
machine in terms of spindle on/off, coolant on/off etc. shown in Table 2.
EOB The EOB character is used at the end of each block to complete a line.
Conversational CNC Programming
The following cycles are typical of the machining operations available when programming a 3-axis
CNC milling machine.
Position. To move the XYZ coordinates at rapid feed rate.
Drill one. To position the tool at a specific XYZ coordinate position in order to automatically drill a
hole. The automatic drill cycles allow for simple drilling, peck drilling, spot-facing & bore cycles.
Line. To cut straight lines along an axis or a diagonal at the desired feed rate.
Arc. To cut a circle or partial circle that is part of a series of cuts that usually includes lines as well.
Face. To define a rectangular zig-zag pattern used to clean off a part surface.
Frame. To cut the inside or outside outline of a rectangle, circle or polygon.
Tool. To enter tool parameters, machine function parameters & program pause/stop codes.
Scale/mirror. To scale and/or mirror other part features.
Rotate. To repeat other part features around a specific center of rotation.
Modern CNC systems have some specially designed functions to simplify the manual programming.
However, since most of these functions are system oriented, it is not intended to discuss them here in
detail. The following paragraphs give a brief description of commonly used functions in modern CNC
systems. The user should refer to the programming manuals of the machine for the detail
programming and operation.
Mirror Image This is the function that converts the programmed path to its mirror image, which is
identical in dimensions but geometrically opposite about one or two axes.
Program Repetition and Looping In actual machining, it is not always possible to machine to the
final dimension in one go. This function enables the looping of a portion of the program so that the
portion can be executed repeatedly.
Pocketing Cycle Pocketing is a common process in machining. This is to excavate the material
within a boundary normally in zigzag path and layer by layer. In a pocketing cycle, the pattern of
cutting is pre-determined. The user is required to input parameters including the length, width and
depth of the pocket, tool path spacing, and layer depth. The CNC system will then automatically work
out the tool path.
Drilling, Boring, Reaming and Tapping Cycle This is similar to pocketing cycle. In this function, the
drilling pattern is pre-determined by the CNC system. What the user has to do is to input the required
parameters such as the total depth of the hole, the down feed depth, the relief height and the dwell
time at the bottom of the hole.
Conversational CNC Programming Examples:
Example 1: Arcs & Lines
As shown in the figure below, the left is the design of the requested part & the right is the actual tool
path. Dashed lines are the tool path for 1/8” diameter endmill.

An analogy to software programming is that conversational programming is similar to programming


using a compiler (i.e., C, Fortran, VB, etc.) & the actual tool path code generated is equivalent to the
final compiled machine code or instructions.
Program Explanation
G90 G0 X0 Y-0.75 Z1 F5 [G90 = absolute; G0 = rapid; F = XY feed]
Z0 M3 [M3 = spindle on, CW]
G1 Z-0.1 E2 [G1 = linear motion; E = Z feed rate]
Y-0.5625
G2 J0.5625 X0 Y0.5625 [G2 = CW circular motion]
G1 X0.6507 [G1 = linear motion]
X1.5625 Y0.03608
Y-0.3
G2 I-0.2625 X1.3 Y-0.5625 [G2 =CW circular motion]
G1 X0 [G1=linear motion]
G0 Y-0.75 Z1 [G0=rapid]
M30 [M30=end of program
Example 2: Arcs & Lines

Program Explanation
N01 G90 Absolute Dimensioning
N02 G00X-30 Y-30 Z100 Rapid move to (X-30, Y-30, Z100)
N03 T01 Using Tool Number 1
N04 G00 Z5 S1000 M03 Rapid move to Z5;
start spindle clockwise at 1000 rpm
N05 G01 Z-10 F100 Feed to Z-10 at 100 mm/min
N06 G41 G01 X0 Y15 F200 Call up compensation,
cutter on the left feed to (X0, Y15) at 200 mm/min
N07 G01 Y66.564 From N07 to N15 is the contour cutting.
N08 G02 X16.111 Y86.183 I20 J0
N09 G02 X93.889 Y86.183 I38.889 J-196.183
N10 G02 X110 Y66.564
I-3.889 J-19.619
N11 G01 Y26.247
N12 G02 X98.882 Y11.758 I-15 J0
N13 G01 X55 Y0
N14 G01 X15
N15 G02 X0 Y15 I0 J15
N16 G40 X-30 Y-30 Cancel of compensation, feed to (X-30, Y-30)
N17 G00 Z100 M30 Rapid move to Z100; program end
Example 3: Turning

Program Explanation
N01 G28 U0.1 W0.1 Return to Machine Zero
N02 G00 U-60.0 W-40.0 Rapid move to Tool Changing position.
N03 G50 X200.0 Z100.0 Assign the Program Zero
N04 G97 S2000 Assign revolution speed as 2000 rpm.
N05 M03 Switch on spindle, turning in forward direction.
N06 T01 Select Tool Number T1 and call tool offset.
N07 G00 X0 Z42.0 Rapid move to (X0, Z42.0)
N08 M08 Switch coolant on
N09 G69 F0.15 Assign feed to be 0.15 mm/rev.
N10 G01 Z40.45 Start cutting the Contour along path A
N11 G03 X 9.217 Z31.13 R5.8
N12 X8.955 Z29.465 R1.556
N13 G02 X 9.6 Z29.1 R1.48
N14 G01 X11.142
N15 G03 X 11.142 Z25.4 R2.398
N16 G01 X16.6 Z9.385
N17 Z8.5
N18 X20.6
N19 Z-3.0 Finish Contouring
N20 G00 X200.0 Z100.0 Rapid move to Tool Changing Position
N21 T0100 Cancel tool offset.
N22 T0202 Select Tool Number T2 and call tool offset.
N23 G00 X21.0 Z9.385 Rapid move to (X21.0 Z3.985)
N24 G01 X16.6 F0.15 Start cutting contour along path B, in 0.15mm/rev feed.
N25 G03 X9.6 Z24.203 R34.2
N26 G01 Z25.4
N27 X14.0 Finish contouring
N28 G00 X200.0 Z100.0 Rapid move to Tool Changing position.
N29 T0200 Cancel tool offset.
N30 T0303 Select Tool Number T3 and call tool offset.
N31 G00 X24.0 Z0 Rapid move to (X24.0 Z0)
N32 G01 X-0.5 F0.06 Part off in feed rate 0.06 mm/rev
N33 G00 X200.0 Z100.0 Rapid move to Tool Changing position.
N34 T0300 Cancel tool offset.
N35 M30 Program end
CNC CAM Programming
Once the part has been designed using conventional mechanical design methods (structural analysis,
FEA, fatigue study, etc.), the part is manufactured using the following method.
(In this course MasterCAM will be demonstrated).
1. A solid 3D model of the part to be produced is created. Any standard CAD format is acceptable.
2. Then the solid model is imported into the CAM (Computer Aided Manufacturing) software.
3. The raw material stock size is input & the part’s coordinate origin is set.
4. The necessary information for each tool used in machining the part features is input. Typically, a
tool library exists, which is a database of tools & their related parameters.
5. For each part feature, the appropriate tool from the library is selected & the parameters necessary
for machining that feature is set. Typical parameters include spindle speed, depth of cut, feed rate,
number of passes, tool path pattern, etc.
6. The programmed tool path(s) is verified by running the CAM software’s virtual machining cycle.

Figure 14: Inventor CAD model of example part (mirrored for clarity).
Figure 15: CAM part setup & coordinate zeroing.

Figure 16: Tool library showing database of previously used tools.

Figure 17. Tool parameters stored for each cutting tool used.
Figure 18. CAM parameters for cutting one feature (pocket) in the part.

Figure 19. CAM roughing & finishing parameters.


Figure 20. CAM operations list showing all cutting operations & tools.

Figure 21. Virtual verification cycle used to catch errors before cutting.

Figure 22. Final program ready to be processed by the CNC machine.


G and M codes used in CNC systems
Table 1: Preparatory commands (G-code)
G Function name G Function name
G00 Point-to-point positioning G40 Cancel tool nose radius compensation
G01 Linear interpolation G41 Tool nose radius compensation-left
G02 Clockwise circular interpolation G42 Tool nose radius compensation-right
G03 Counter-clockwise circular interpolation G43 Cutter length compensation
G04 Dwell G44 Cancel cutter length compensation
G05 Hold G90 Absolute dimensions
G33 Thread cutting, constant lead G91 Incremental dimensions
G70 Dimensions in inches G92 Datum offset
G71 Metric dimensions
Table 2: Miscellaneous commands (M-code)
M Function name M Function name
M00 Program stop M08 Flood coolant on
M01 Optional stop M09 Coolant off
M02 End of program M10 Clamp
M03 Spindle starts clockwise M11 Unclamp
M04 Spindle starts counterclockwise M13 Spindle clockwise, coolant on
M05 Spindle stop M14 Spindle counterclockwise, coolant on
M06 Tool change M30 End of tape, rewind
M07 Mist coolant on
Table 3: 4-7-2 G Functions (SEICOS-MII)
G- G-
Function Function Group
code code
G00 Positioning (rapid traverse) G02 Circular interpolation CW
01
G01 Linear interpolation (cutting feed) G03 Circular interpolation CCW
G04 Dwell G09 Exact stop check
00
G07 SIN interpolation (designation of virtual axis) G10 Setting offset & work zero-point offset amount
G17 Designation of X-Y plane G19 Designation of Y-Z pla11e
02
G18 Designation of Z-X plane
G20 Inch input G21 Metric input 03
G22 Stored stroke limit, ON G23 Stored stroke limit, OFF 04
G27 Return to reference point G30 Return to 2nd reference point
G28 Return to reference point G31 Skip function 00
G29 Return from reference point
G40 Tool diameter compensation cancel G42 Tool diameter compensation to right
07
G41 Tool diameter compensation to left
G43 Tool length compensation"+" G44 Tool length compensation "-"·
08
G49 Tool length compensation cancel
G45 Tool offset expansion G47 Tool offset double expansion
00
G46 Tool offset reduction G48 Tool offset double reduction
G50 Scaling cancel G51 Scaling 11
G52 Local coordinate system setting G53 Machine coordinate system selection 00
G54 Work coordinate system 1 selection G57 Work coordinate system 4 selection
G55 Work coordinate system 2 selection G58 Work coordinate system 5 selection 12
G56 Work coordinate system 3 selection G59 Work coordinate system .6 selection
G60 One directional positioning 00
G61 Exact stop check mode G64 Continuous cutting mode
13
G63 Tapping mode
G65 Macro call 00
G66 Macro modal call A
14
G67 Macro modal call cancel
G73 Peck drilling cycle G84 Tapping cycle
G74 Reverse tapping cycle G85 Boring cycle
G76 Fine boring G86 Boring cycle
09
G80 Canned cycle cancels G87 Back boring cycle
G81' Drilling cycle, spot boring G88 Boring cycle
G82 Drilling cycle, counter boring G89 Boring cycle
G- G-
Function Function Group
code code
G83 Peck drilling cycle
G90 Absolute programming G91 Incremental programming 03
G92 Programming of absolute zero point 00
G98 Initial level return (canned cycle) G99 R point level return (canned cycle) 10
G501 Programmable mirror image cancels G511 Programmable mirror image 15
G codes with " " are set when the power is turned on.
G40, G49 and G80 are set by resetting the NC unit.
Table 3: 4-7-3 M Functions (*: Optional function)
M Function name M Function name
00 Program stop '*46 Spare tool offset disabled
01 Optional stop *47 Jet coolant start
02 End of program 48 Feed rate override enabled
03 Spindle forward 49 Feed rate override 100%
04 Spindle reverse *50 Oil hole coolant start
05 Spindle stop *52 Tool breakage detect
06 Tool change ATC *60 Work change APC
*07 Mist coolant start *68 Additional axis clamp
08 Flood coolant start *69 Additional axes unclamp
09 Mist coolant stop *70 M70 output
*10 Mist coolant attitude 1 *71 M71 output
*11 Mist coolant attitude 2 *72 M72 output
*12 Work count *73 M73 output
13 Spindle forward & coolant start *74 Skip selection OFF
14 Spindle reverse & coolant start *75 Skip selection ON
15 M13/M14 stop *78 Additional axis clamp
*16i Measurement air blow ON *79 Additional axes unclamp
*17 Measurement air blow OFF *80 Tool nose air blow ON
*18 Measuring spindle orientation *86 Measurement NG tool breakage detect
19 Spindle orientation 98 Subprogram call
*20 Machining time monitoring 99 End of subprogram
*26 Melodia (1) *100 Arm swing-in to spindle side
*27 Melodia (2) *102 Arm advance
*28 Setting load level 0 *103 Arm turn CW
*29 Setting load level 1 *104 Arm turn CCW
30 End of tape *105 Arm retract
*31 Chip conveyor starts *106 Arm slide to home position__
*32 M33 cancel *108 Arm slide to magazine side
*33 Idle cutting time reduction (modal) *119 Orientation
*34 Idle cutting time reduction (unmodal) *120 Magazine positioning pin OUT
*35 Automatic start ON *121 Magazine positioning pin IN
*36 Automatic start OFF *124 Pallet slider advance (APC)
*38 Spindle no-load detect function stop *125 Pallet unclamps (APC)
*39 M38 cancel *126 Pallet slider retracts (APC)
*40 Tool nose air blow ON *127 Pallet right turn (APC)
*41 Tool nose air blow OFF *128 Pallet left turn (APC)
*45 Spare tool offset enabled *129 Pallet unclamps (APC)

You might also like