Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 90

Scanned by CamScanner

Lords Institute of Engineering and Technology Page No:

computer numerical control


(CNC)
Computer numerical control (CNC) is a method for automating control of machine tools through
the use of software embedded in a microcomputer attached to the tool. It is commonly used in
manufacturing for machining metal and plastic parts.

With CNC, each object to be manufactured gets a custom computer program, usually written in
an international standard language called G-code, stored in and executed by the machine control
unit (MCU), a microcomputer attached to the machine. The program contains the instructions
and parameters the machine tool will follow, such as the feed rate of materials and the
positioning and speed of the tool's components. Mills, lathes, routers, grinders and lasers are
common machine tools whose operations can be automated with CNC. It can also be used to
control non-machine tools, such as welding, electronic assembly and filament-winding machines.

Early in the process, engineers create a computer-aided design (CAD) drawing of the part to be
manufactured, then translate the drawing into G-code. The program is loaded onto the MCU and
a human operator performs a test run without the raw material in place, to ensure proper
positioning and performance. This step is important because incorrect speed or positioning can
damage both the machine and the part.

CNC is considered to provide more precision, complexity and repeatability than is possible with
manual machining. Other benefits include greater accuracy, speed and flexibility, as well as
capabilities such as contour machining, which allows milling of contoured shapes, including
those produced in 3D designs. On the other hand, CNC can be more expensive, require more
maintenance than other production methods and compel companies to hire a skilled CNC
programmer.

Subject: CNC Technology


Page No:

Guideways
Functions of Guideways

The Guideway is one of the important elements of machine tool. The main function of the guideway is to
make sure that the cutting tool or machine tool operative element moves along predetermined path. The
machine tool operative element carries workpiece along with it. The motion is generally circular for
boring mills, vertical lathe, etc. while it is straight line for lathe, drilling, boring machines, etc.

Requirements of guideways are: (a) Guideway should have high rigidity. (b) The surface of guideways
must have greater accuracy and surface finish. (c) Guideways should have high accuracy of travel. It is
possible only when the deviation of the actual path of travel of the operative element from the
predetermined normal path is minimum. (d) Guideways should be durable. The durability depends upon
the ability of guideways to retain the initial accuracy of manufacturing and travel. (e) The frictional forces
acting on the guideway surface must be low to avoid wear. (f) There should be minimum possible
variation of coefficient of friction. (g) Guideways should have good damping properties.

TYPES OF GUIDEWAYS
The guideways are mainly classified according to the nature of friction between contacting surfaces of the
operative element:

(a) Guideways with sliding friction

(b) Guideways with rolling friction

(a) Guideways with Sliding Friction

The friction between the sliding surfaces is called as guideways with sliding friction. These guideways
are also called as slideways. The slideways are further classified according to the lubrication at the
interface of contacting surfaces. The friction between the sliding surfaces may be dry, semi-liquid, and
liquid. When the lubrication is absent in between contacting surfaces, it is called as dry friction. Dry
friction is rarely occurred in machine tools. When two bodies slide with respect to each other having
lubrication between them, the sliding body tends to rise or float due to hydrodynamic action of the
lubricant film.

The sliding surfaces are completely separated by the lubricant film and liquid friction occurs at their
interface. The slideways in which the sliding surfaces are separated by the permanent lubricant layer are
known as hydrodynamic slideways. This permanent lubrication layer is due to hydrodynamic action. A
permanent lubricant layer between the sliding surfaces can be obtained by pumping the liquid into the
interface under pressure at low sliding speed. The sliding body is lifted by this permanent lubricant layer.
Such slideways are called as hydrostatic slideways.

The most commonly used shapes of guiding elements of slide ways are:
(i) V-type: The V-type slideways are advantageous because of the automatic adjustment due to
gravity action which always keeps the surfaces in contact, thus the possibility of any play is
eliminated. In addition, the wedging action due to cross winding is also prevented and there is no
Page No:

possibility of chips falling on the V-surface and getting entrapped into it. It has no tendency to
accumulate dust.

The disadvantage of V-type guides is that it wears away rapidly due to lack of bearing surface, and is
difficult to manufacture.

(ii) Flat type: Flat type-slideways are simple in construction and offer quite a large bearing area to
the moving parts. Therefore, to overcome the disadvantage of V-type slideways by the advantages of
the flat type slideways, generally these two together are used for guides as in lathes. Separate guides
are provided for the saddle and tail-stock movement so that any wear caused by the saddle movement
does not affect the height of tail stock centre. The flat type bed guides the saddle by the side guides
and in offer to prevent lifting movement the retaining pieces are fitted below the flat bed.

(iii) Dovetail type: Dove tail type slideways are preferred when the location of the moving parts is
considered essential. These are generally used for milling machine tables, saddles and knees. In
dovetail type slideways, adjustment for wear can be made by parallel blocks pushed by set screws.
Dovetail slideways occupy small space. A gib strip is provided so that it can be adjusted to ensure
that the two elements of the slide are a good sliding fit.

(iv) Circular or cylindrical type: Cylindrical slide fulfils the conditions of kinematic principles
being fully constrained. These guides are used in the pillar or radial drilling machines. Clearance
between mating surfaces of slideways are inevitable because of wear and manufacturing
imperfections. Clearance between flat ways may be controlled periodically by means of three gibs or
strips.

Guideways with Rolling Friction


These are also called as anti friction ways. The anti friction slideways may be classified according to the
shape of the rolling element as:

(a) Roller type anti friction ways using cylindrical rollers.

(b) Ball type anti friction ways using spherical balls.

Advantages of roller friction type guideways:

a) Low frictional resistance

b) No stickslip

c) Easy of availability

d) High load carrying capacity

e) High transverse speed


Page No:

Disadvantages:

a) Lower damping capacity

Example:

a) Non re-circulating ball roller cage

Drives and Mechanisms


Elements of CNC machine tools: electric motors

1. Drives Basic function of a CNC machine is to provide automatic and precise motion control
to its elements such work table, tool spindle etc. Drives are used to provide such kinds of
controlled motion to the elements of a CNC machine tool. A drive system consists of drive
motors and ball lead-screws. The control unit sends the amplified control signals to actuate drive
motors which in turn rotate the ball lead-screws to position the machine table or cause rotation of
the spindle.

2. Power drives: Drives used in an automated system or in CNC system are of different types
such as electrical, hydraulic or pneumatic.

• Electrical drives: These are direct current (DC) or alternating current (AC) servo motors. They
are small in size and are easy to control.

• Hydraulic drives: These drives have large power to size ratio and provide stepless motion with
great accuracy. But these are difficult to maintain and are bulky. Generally they employ
petroleum based hydraulic oil which may have fire hazards at upper level of working
temperatures. Also hydraulic elements need special treatment to protect them against corrosion.

• Pneumatic drives: This drives use air as working medium which is available in abundant and is
fire proof. They are simple in construction and are cheaper. However these drives generate low
power, have less positioning accuracy and are noisy. In CNC, usually AC, DC, servo and stepper
electrical drives are used. The various drives used in CNC machines can be classified as: a.
Spindle drives to provide the main spindle power for cutting action b. Feed drives to drive the
axis.

Spindle drives
The spindle drives are used to provide angular motion to the workpiece or a cutting tool. Figure
shows the components of a spindle drive. These drives are essentially required to maintain the
speed accurately within a power band which will enable machining of a variety of materials with
Page No:

variations in material hardness. The speed ranges can be from 10 to 20,000 rpm. The machine
tools mostly employ DC spindle drives.

But as of late, the AC drives are preferred to DC drives due to the advent of microprocessor-
based AC frequency inverter. High overload capacity is also needed for unintended overloads on
the spindle due to an inappropriate feed. It is desirous to have a compact drive with highly
smooth operation.

Feed Drives

These are used to drive the slide or a table. Figure shows various elements of a feed drive. The
requirements of an ideal feed drive are as follows.
• The feed motor needs to operate with constant torque characteristics to overcome friction and
working forces.
• The drive speed should be extremely variable with a speed range of about 1: 20000, which
means it should have a maximum speed of around 2000 rpm and at a minimum speed of 0.1 rpm.
• The feed motor must run smoothly.
• The drive should have extremely small positioning resolution.
• Other requirements include high torque to weight ratio, low rotor inertia and quick response in
case of contouring operation where several feed drives have to work simultaneously. Variable
speed DC drives are used as feed drives in CNC machine tools. However now-a-days AC feed
drives are being used.
Page No:

Electrical drives

Electric drives are mostly used in position and speed control systems. The motors can be
classified into two groups namely DC motors and AC motors (Fig. 4.1.3). In this session we shall
study the operation, construction, advantages and limitations of DC and AC motors.
DC motors
A DC motor is a device that converts direct current (electrical energy) into rotation of an element
(mechanical energy). These motors can further be classified into brushed DC motor and
brushless DC motors.

Brush type DC motor

A typical brushed motor consists of an armature coil, slip rings divided into two parts, a pair of
brushes and horse shoes electromagnet as shown in Fig. A simple DC motor has two field poles
namely a north pole and a south pole. The magnetic lines of force extend across the opening
between the poles from north to south. The coil is wound around a soft iron core and is placed in
between the magnet poles. These electromagnets receive electricity from an outside power
source. The coil ends are connected to split rings. The carbon brushes are in contact with the split
rings. The brushes are connected to a DC source. Here the split rings rotate with the coil while
the brushes remain stationary.
The working is based on the principle that when a current-carrying conductor is placed in a
magnetic field, it experiences a mechanical force whose direction is given by Fleming's left-hand
rule. The magnitude of the force is given by
𝐹=𝐵𝐼𝐿𝑠𝑖𝑛𝜃 (4.1.1)
Where, B is magnetic field density in weber/m2
I is the current in amperes and
L is the length of the conductor in meter
θ is the angle between the direction of the current in the conductor and the electric field
If the current and filed are perpendicular then θ=90°. The equation 4.1.1 becomes,
𝐹=𝐵𝐼𝐿 (4.1.2) A direct current in a set of windings creates a magnetic field. This field
produces a force which turns the armature. This force is called torque. This torque will cause
the armature to turn until its magnetic field is aligned with the external field. Once aligned the
direction of the current in the windings on the armature reverses, thereby reversing the
polarity of the rotor's electromagnetic field. A torque is once again exerted on the rotor, and it
continues spinning. The change in direction of current is facilitated by the split ring
commutator. The main purpose of the commutator is to overturn the direction of the electric
current in the armature. The commutator also aids in the transmission of current between the
armature and the power source. The brushes remain stationary, but they are in contact with
the armature at the commutator, which rotates with the armature such that at every 180° of
rotation, the current in the armature is reversed.
Advantages of brushed DC motor:
• The design of the brushed DC motor is quite simple
• Controlling the speed of a Brush DC Motor is easy
• Very cost effective

Disadvantages of brushed DC motor:


• High maintenance
• Performance decreases with dust particles
• Less reliable in control at lower speeds
• The brushes wear off with usage

A brushless DC motor has a rotor with permanent magnets and a stator with windings. The rotor can
be of ceramic permanent magnet type. The brushes and commutator are eliminated and the windings
are connected to the control electronics. The control electronics replace the commutator and brushes
and energize the stator sequentially. Here the conductor is fixed and the magnet moves (Fig. 4.1.5).
The current supplied to the stator is based on the position of rotor. It is switched in sequence using
transistors. The position of the rotor is sensed by Hall effect sensors. Thus a continuous rotation is
obtained.

AC Motors
AC motors convert AC current into the rotation of a mechanical element (mechanical energy). As in
the case of DC motor, a current is passed through the coil, generating a torque on the coil. Typical
components include a stator and a rotor. The armature of rotor is a magnet unlike DC motors and the
stator is formed by electromagnets similar to DC motors. The main limitation of AC motors over DC
motors is that speed is more difficult to control in AC motors. To overcome this limitation, AC
motors are equipped with variable frequency drives but the improved speed control comes together
with a reduced power quality.
The working principle of AC motor is shown in fig. 4.1.6. Consider the rotor to be a permanent
magnet. Current flowing through conductors energizes the magnets and develops N and S poles. The
strength of electromagnets depends on current. First half cycle current flows in one direction and in
the second half cycle it flows in opposite direction. As AC voltage changes the poles alternate.

Tool Monitoring Systems


When unmanned machining takes place, the monitoring system will need to provide a degree of
"artificial intelligence" necessary to duplicate the experience provided by a fully skilled operator
with instinctive reactions. The tool-related monitoring functions dutifully carried out by an
operator whilst manufacturing parts on such machines may be classified under the following
headings:

monitoring tool life and cutting conditions

breakage detection

tool offset measurement

tool identification

Tool identification and offset measurement were discussed in section 2.7, but this is by no means
the only way of establishing tool offset data and identification, as we shall see a little later on.
However, let us confine our thoughts to the means of monitoring and controlling the tool life and
breakage detection.

Whenever cutting tools are engaged in the manufacture of parts there is an interac- tion between
the workpiece, chips and tool, causing tool wear. It is essential that any worn tools (at a pre-
determined level of wear) must be replaced before their predicted failure occurs. During
unmanned machining, tool sensing is necessary in order to establish the extent of wear and
activate a tool change so as to optimise its useful life. In recent years, a variety of sensing
techniques have been developed and are classified
into two distinct groups: direct sensing methods, which include

(a) the measurement of electrical resistance

(b) techniques based on radiography

(c) dimensional changes in workpiece via measurement, or alternatively, the distance from the
tool post to the part indirect sensing methods, covering methods based on temperature, vibration,
sound, acoustic emission and force measurement, which can be measured directly or by torque,
current, and power measurements It should be said that many of the methods listed above have
proved to be satisfactory in the laboratory, but few have been "workshop hardened" for industrial
applications.

The tool monitoring systems available of late tend to be classified into three groups, as those
involving: recording machining time tool breakage detection devices touch-trigger probing

The latter method is reviewed later in the chapter but for now we will concentrate on the
methods used to protect the tool and hence workpiece from the vagaries of the cutting process,
whilst offering numerous other advantages during cutting. The simplest device to be used for
tool wear prediction is the former method and is offered by numerous machine tool companies. It
focuses on the estimation of the machining time which has elapsed whilst cutting components.
The permitted tool life is deter- mined by software within the controller, which can be specified
according to the tool and workpiece combinations and cutter geometries, together with other
related factors. The operation of such systems is simple: during cutting, when the feed functions
for both circular and linear interpolations are monitored, the controller accumulates data on the
actual time employed. Once this time has reacheda prescribed level a "worn tool" alarm is
triggered and the tool is changed as soon as it is safe to do so. In this manner cutting life is
optimised, but the approach to such techniques is based on steady-state machining and it can be
influenced by unexpected, interrupted and abusive cutting conditions, which can be considered a
draw-back, but this solution to tool wear control is a relatively cheap option and as such cannot
be severely criticised.

A more sophisticated method of tool breakage detection based on the indirect approach to
sensing, using adaptive control techniques has been around for some time. In the early days it
was an adaptive control optimisation (ACO) system which was developed using a form of in-
process measurement to assess such factors as tool wear rates, spindle deflection and vibration. It
suffered from poor sensitivity in monitoring tool wear in a productive environment and was
plagued with troublesome sensing methods. Lately, the adaptive control constraint (ACC)
technique has proved to be most popular and is simpler in design and use, whilst costing
considerably less. These "feed-only" systems, as they are sometimes referred to, are still quite
complex and have unique sensory circuits and computation methods for establishing the net
torque during cutting and comparing the monitored value to a preset torque limit.
Page No:

They are often known as torque-controlled machining (TCM) systems. To have such systems
present is a boon on any machine tool, with the costs of such options being of the order of 5% of
the total machine's cost. A machining centre application (Fig.) and a turning centre application
(Fig.) are illustrated schematically and the benefits they accrue to the optimisation of any cutting
process are listed. An obvious problem associated with any torque-controlled machining
monitor, is that if insufficient torque is developed - in the case of small drills, taps and milling
cutters on machining centres, or small diameter workpieces on turning centres – then when they
are under approximately 10 mm diameter, lack of torque makes them obsolete. To overcome this
problem and alleviate such "blind spots" in the machining of .:ritical features in this size zone for
cutters, a further monitoring system is available which complements TCM monitors and is
known as acoustic emission (AE). In principle, the acoustic emission technique is shown in Fig.
2.27 and has a variety ofsources for the generation of sound waves during the cutting process
(Fig.b). The AE signals generated are filtered out, so that only the ultrasonic waves released by
the generation of high-frequency elastic stress waves - whilst cutting - are sensed, owing to the
rapid release of strain energy which is caused by such factors as material deformation, fracture,
and metallurgical phase changes. In order to monitor the AE signal, it is usual to use
piezoelectric sensors which detect the AE amplitude showing a rising tendency (often termed
"tare") just as the tool is about to break (Fig.). It is quite straightforward to separate out the AE
signal from extraneous noises generated by the machine tool, owing to the very high frequency
of this signal. These fast-response piezoelectric sensors require the minimum of power input and
are characterised by their high resolution and sensitivity. The electrical signal produced is
proportional to the measured value and can be amplified for machine tool control. In principle
AE active sensors utilise the piezoelectric effect, in which electrical charges are formed on the
surfaces of particular crystals such as quartz, tourmaline, etc, when they are subjected to
mechanical stress. The reciprocal piezoelectric effect is the reverse of this process and is used to
power quartz clocks and watches, by deforming the crystal by an electrical charge. The
mechanical deformation of the direct piezoelectric sensors used on machine tools produces
electrical charges with virtually no delays and as a result can be used in high-speed machining
operations, or when
metalcutting experience by the tool builders over many years and detect the characteristic changes resulting from tool
failure. Such systems utilise yet further algorithms for the detection of wear, breakage and collision, providing
separate outputs to the machine tool for each occurrence. Any tool breakage tends to be both
sudden and catastrophic, and is characterised by distinct changes in the force signals. Typical
signals (as depicted in Fig. 2.28) showing the force signal characterised by breakage, are
detected using "pattern recognition" techniques. These real-time force signal events show key
parameters which are assessed in terms of significant spikes and sudden changes in force levels.
When such an event occurs, it is recognised as a characteristic, say, of a broken tool pattern
based on "prior experience", which is incorporated within the software and a "broken tool" signal
is generated. A user of such systems can select the worn tool variable over a range from level
one, for finishing cuts, to level ten, for heavy roughing. One might ask the question, "Why do we
need so much sophisticated tool and subsequent machine protection in stand-alone or FMS
environment?". The answer to this can be found by considering the consequences of not
providing such monitoring equipment: in a recent German survey it was determined that a typical
collision resulted in around £7500 worth of damage to the machine tool. This is exacerbated by
the staggering statistics that for all tool collisions, 72% were the direct result of operator error,
whilst only 26% were traced to faults in the electrical systems, with 2% of all faults unclassified.
These results clearly show the advantages of incorporating tool/machine protection devices for a
relatively small capital cost. If ·advantages can be gained, or protection provided by tool
monitoring, there must be similar benefits from utilising workpiece gauging and inspection
monitoring techniques, and this will be the theme of the following section.
Page No:

Unit – II

Tooling for CNC machines


Preset Tools
The setting of tools in advance at a place away from the machine tool or offline, in special
holders is known as preset tools. A presetting device is used to preset axial and radial positions
of the tool tip on the tool holder. Once this is done, the tool holder is ready to be mounted on the
machine and produce a known dimension. Presetting devices to various levels of sophistication
are available like optical projector. Tool length and tool diameter compensation facilities
available in the present day CNC machines have brought down the importance of presetting.
Since the generation of actual geometry is taken care of by the CNC part program, which is
essentially the coordinates through which the cutting tool tip moves, it is important to know the
actual dimensions of the tool when it is placed in the spindle. The relationship of the tool with
reference to the tool holding mechanism requires a special attention during CNC machining
process. The actual point to be programmed in a CNC part program is the tip of the tool whereas
the axes will be moving with respect to a known point in the spindle, e.g. the centre of the
spindle in case of machining centres. It becomes therefore necessary to know precisely the
deviation of the tool tip from the gauge point on the spindle.
Qualified Tools
Tool which fits into a location on the machine, where its cutting edge is accurately positioned
within close limits relative to a specified datum on the tool holder or slide, is known as qualified
tool. The cutting tools satisfy the following requirements:
(a) Tools need not be measured individually.
(b) No presetting device is used.
(c) The dimensions of the tool holder which are fixed and known.
(d) Set up time is reduced.
(e) Control dimensions of the tool are nominal and fixed.
(f) Higher control on resharpening e.g. drills, reamers.
(g) Cutter for better size control e.g. end mills, teamers.
(h) Chip breaking facilities incorporated in tool.
(i) Impoved designs.

The qualified tool with holder shown in Figure 5.1


A modular fixturing system is composted of standardized components that allow for flexible
arrangement and interchangeability between different applications. The versatility of the
components makes it a viable alternative to traditional fixturing methods because a single
modular fixture system is capable of doing the same work as numerous dedicated fixturing
systems.
Modular Fixturing Components Tooling Plates and Blocks

As stated above, a modular fixturing system is made up of many flexible and interchangeable
components. Likely the most fundamental and important component is the tooling plate or
tooling block. These are also commonly known as fixturing plates, tooling columns, and
tombstones. Modular tooling plates feature a grid of locating holes which are used to attach
clamping
devices, work supports, stops, and any other components necessary to correctly position the
work piece for the application. The tooling plate's multipurpose holes provide increased
flexibility for other modular components because they can be located or positioned anywhere on
the grid. This allows for many different set ups to be created on a single fixturing plate.

Quick-Change Tooling System


Insert the collet or tool holder in the spindle. Push back on the quill handle. You’ve turned
Minutes into seconds!
Change Tools in Seconds!
Install the patented Mach-1 mechanical drawbar system in your Bridgeport or other knee mill to
reduce job setup and increase accuracy and repeatability. A ground pull stud snaps the collet or
tool holder in place with a short push of the quill handle. A collet closer will secure the tool in
the collet so that when the collet is removed from the spindle, the tool will maintain the Z-axis
position or length characteristics when needed. The Mach-1 Tooling System will pay for itself in
a matter of days!
Automatic head changers:-
An automatic tool changer in a machine tool for automatically changing a tool. The machine tool
includes a main frame, a main spindle head movably provided to the main frame, a main spindle
rotatably disposed in the main spindle head, the main spindle head being movable in an axial
direction of the main spindle, and a tool magazine provided with a rotatable magazine base for
holding a plurality of tool holders and for rotationally indexing one of the tool holders, whereby
the one of rotationally indexed tool holder is changed by a tool holder provided at the main
spindle. The automatic tool changer comprises; a plurality of tool holder gripping means radially
arranged on and pivotably supported to the magazine base, the tool magazine being secured to a
stationary portion of the main frame, and means for pivotting one of the tool holder gripping
means rotationally indexed independent of remaining tool holder gripping means. The pivotting
means moves the one of tool holder gripping...
Claims
1. An automatic tool changer for use in a machine tool for automatically changing a tool, the
machine tool including a main frame, a main spindle head movably provided with respect to the
main frame, a main spindle rotatably disposed in the main spindle head with the main spindle
head being movable in an axial direction of the main spindle, and a tool magazine provided with
a rotatable magazine base for holding a plurality of tool holders and for rotationally indexing one
of the tool holders such that one of the rotationally indexed tool holders may be interchanged
with a tool holder provided at the main spindle, the automatic tool changer comprising:
a plurality of tool holder gripping means radially arranged on and pivotably supported by said
magazine base, said tool magazine being secured to a stationary portion of said main frame; and,
means for pivoting one of said tool holder gripping means independently of the remaining tool
holder gripping means, said pivoting means including a moving means for moving said one of
said tool holder gripping means toward and away from said main spindle, said moving means
being operative to move said one of said tool holder gripping means away from said main
spindle at times when said main spindle head is moved towards a work piece for machining.
2. The automatic tool changer as defined in claim 1, wherein said tool magazine further
comprises a plurality of pivot shafts radially arranged with respect to said magazine base, each of
said plurality of tool holder gripping means being pivotally supported by a respective one of said
pivot shafts.
3. The automatic tool changer as defined in claim 1, wherein each of said tool holder gripping
means comprises a first portion, an intermediate portion, and a second portion, said first portion
being in association with said magazine base for normally urging said tool holder gripping means
toward said main spindle head, said intermediate portion being rotatably supported by said pivot
shaft, and said second portion being provided with a bifurcated portion for gripping said tool
holder.
4. The automatic tool changer as defined in claim 1, wherein said pivoting means comprises a
first cam follower provided on each of said tool holder gripping means at a position in
confrontation with said main spindle head; and a first cam surface provided on said main spindle
head and at a position in confrontation with said tool magazine.
5. The automatic tool changer as defined in claim 4, wherein said first portion of said tool holder
gripping means comprises a biasing means for biasing said second portion toward said main
spindle head.
6. The automatic tool changer as defined in claim 4, wherein said pivoting means further
comprises a second cam follower provided at said tool holder gripping means at a position in
Page No:

confrontation with said main spindle head, and a second cam surface provided at said main
spindle head and at a position in confrontation with said tool magazine, said second cam follower
being selectively engageable with said second cam surface in response to movement of said main
spindle head, said second cam surface being adapted to prevent said tool holder gripping means
from excessive pivotal movement to a direction away from said main spindle head against
biasing force of said biasing means.
7. The automatic tool changer as defined in claim 4, wherein each of said tool holder gripping
means defines a central line along longitudinal direction thereof, said first cam follower being
positioned opposite to said second cam follower with respect to said central line.
8. The automatic tool changer as defined in claim 3, wherein said tool holder gripping means
comprises a grip arm having said first, intermediate and second portions; and wherein each of
said tool holders has a maximum diameter portion formed with annular V-shaped groove, and
wherein said bifurcated portion comprises two bifurcated members each formed with a bore
extending in a direction perpendicular to said grip arm; retractable pins disposed in said bores,
and spring means disposed in said bores for biasing said pins, said pins being engageable with
said annular V-shaped groove.
9. The automatic tool changer as defined in claim 1, further comprising: clamping and
unclamping means for clamping and unclamping one of said tool holder with respect to said
main spindle synchronously with an operation of said pivotting means and with the movement of
said main spindle head.

NC PART PROGRAMMING
Types of part programming, Computer aided part programming, Part programming manual, Part
programme using sub routines, do loops and fixed cycles are described in this Unit.

TYPES OF PART PROGRAMMING


The part program is a sequence of instructions, which describe the work, which has to be done on a part,
in the form required by a computer under the control of a numerical control computer program. It is the
task of preparing a program sheet from a drawing sheet. All data is fed into the numerical control system
using a standardized format. Programming is where all the machining data are compiled and where the
data are translated into a language which can be understood by the control system of the machine tool.
The machining data is as follows :
(a) Machining sequence classification of process, tool start up point, cutting depth, tool path, etc.

(b) Cutting conditions, spindle speed, feed rate, coolant, etc.

(c) Selection of cutting tools.

While preparing a part program, need to perform the following steps :


(a) Determine the startup procedure, which includes the extraction of dimensional data from part
drawings and data regarding surface quality requirements on the machined component.
(b) Select the tool and determine the tool offset.

Subject: CNC Technology


Page No:

(c) Set up the zero position for the workpiece.


(d) Select the speed and rotation of the spindle.

(e) Set up the tool motions according to the profile required.

(f) Return the cutting tool to the reference point after completion of work.

(g) End the program by stopping the spindle and coolant.

The part programming contains the list of coordinate values along the X, Y and Z directions of the entire
tool path to finish the component. The program should also contain information, such as feed and speed.
Each of the necessary instructions for a particular operation given in the part program is known as an NC
word. A group of such NC words constitutes a complete NC instruction, known as block. The commonly
used words are N, G, F, S, T, and M. The same is explained later on through examples.
Hence the methods of part programming can be of two types depending upon the two techniques as
below:
(a) Manual part programming, and

(b) Computer aided part programming.

Manual Part Programming


The programmer first prepares the program manuscript in a standard format. Manuscripts are typed with a
device known as flexo writer, which is also used to type the program instructions. After the program is
typed, the punched tape is prepared on the flexo writer. Complex shaped components require tedious
calculations. This type of programming is carried out for simple machining parts produced on point-to-
point machine tool.
To be able to create a part program manually, need the following information :
(a) Knowledge about various manufacturing processes and machines.

(b) Sequence of operations to be performed for a given component.


(c) Knowledge of the selection of cutting parameters.

(d) Editing the part program according to the design changes.

(e) Knowledge about the codes and functions used in part programs.

Computer Aided Part Programming


If the complex-shaped component requires calculations to produce the component are done by the
programming software contained in the computer. The programmer communicates with this system
through the system language, which is based on words. There are various programming languages
developed in the recent past, such as APT (Automatically Programmed Tools), ADAPT, AUTOSPOT,
COMPAT-II, 2CL, ROMANCE, SPLIT is used for writing a computer programme, which has English
like statements. A translator known as compiler program is used to translate it in a form acceptable to
MCU.
The programmer has to do only following things :
(a) Define the work part geometry.

Subject: CNC Technology


Page No:

(b) Defining the repetition work.

(c) Specifying the operation sequence.


Over the past years, lot of effort is devoted to automate the part programme generation. With the
development of the CAD (Computer Aided Design)/CAM (Computer Aided Manufacturing) system,
interactive graphic system is integrated with the NC part programming. Graphic based software using
menu driven technique improves the user friendliness. The part programmer can create the geometrical
model in the CAM package or directly extract the geometrical model from the CAD/CAM database. Built
in tool motion commands can assist the part programmer to calculate the tool paths automatically. The
programmer can verify the tool paths through the graphic display using the animation function of the
CAM system. It greatly enhances the speed and accuracy in tool path generation.

FUNDAMENTAL ELEMENTS FOR DEVELOPING MANUAL


PART PROGRAMME
The programmer to consider some fundamental elements before the actual programming steps of a part
takes place. The elements to be considered are as follows :
4.3.1 Type of Dimensioning System
We determine what type of dimensioning system the machine uses, whether an absolute or incremental
dimensional system

Subject: CNC Technology


Page No:

4.3.2 Axis Designation


The programmer also determines how many axes are availed on machine tool. Whether machine tool has
a continuous path and point-to-point control system that has been explained in Unit 2.
4.3.3 NC Words
The NC word is a unit of information, such as a dimension or feed rate and so on. A block is a collection
of complete group of NC words representing a single NC instruction. An end of block symbol is used to
separate the blocks. NC word is where all the machining data are compiled and where the data are
translated in to a language, which can be understood, by the control system of the machine tool.
Block of Information
NC information is generally programmed in blocks of words. Each word conforms to the EIA standards
and they are written on a horizontal line. If five complete words are not included in each block, the
machine control unit (MCU) will not recognize the information; therefore the control unit will not be
activated. It consists of a character N followed by a three digit number raising from 0 to 999.

Using the example shown in Figure 4.2. The words are as follows :
N001 – represents the sequence number of the operation.
G01 – represents linear interpolation.
X12345 – will move the table in a positive direction along the X-axis.
Y06789 – will move the table along the Y-axis.
M03 – Spindle on CW and
; – End of block.
4.3.4 Standard G and M Codes
The most common codes used when programming NC machines tools are G-codes (preparatory
functions), and M codes (miscellaneous functions). Other codes such as F, S, D, and T are used for
machine functions such as feed, speed, cutter diameter offset, tool number, etc. G-codes are sometimes
called cycle codes because they refer to some action occurring on the X, Y, and/or Z-axis of a machine
tool. The G-codes are grouped into categories such as Group 01, containing codes G00, G01, G02, G03,
which cause some movement of the machine table or head. Group 03 includes either absolute or
incremental programming. A G00 code rapidly positions the cutting tool while it is above the workpiece
from one point to another point on a job. During the rapid traverse movement, either the X or Y-axis can
be moved individually or both axes can be moved at the same time. The rate of rapid travel varies from
machine to machine.

Subject: CNC Technology


Page No:

The total numbers of these codes are 100, out of which some of important codes are given as under with
their functions :
G-Codes (Preparatory Functions)
Code Function
G00 Rapid positioning
G01 Linear interpolation
G02 Circular interpolation clockwise (CW)
G03 Circular interpolation counterclockwise (CCW)
G20 Inch input (in.)
G21 Metric input (mm)
G24 Radius programming
G28 Return to reference point
G29 Return from reference point
G32 Thread cutting
G40 Cutter compensation cancel
G41 Cutter compensation left
G42 Cutter compensation right
G43 Tool length compensation positive (+) direction
G44 Tool length compensation minus (-) direction
G49 Tool length compensation cancels
G 53 Zero offset or M/c reference
G54 Settable zero offset
G84 canned turn cycle
G90 Absolute programming
G91 Incremental programming
Note : On some machines and controls, some may be differ.
M-Codes (Miscellaneous Functions)
M or miscellaneous codes are used to either turn ON or OFF different functions, which control certain
machine tool operations. M-codes are not grouped into categories, although several codes may control the
same type of operations such as M03, M04, and M05, which control the machine tool spindle. Some of
important codes are given as under with their function s:
Code Function
M00 Program stop
M02 End of program
M03 Spindle start (forward CW)
M04 Spindle start (reverse CCW)
M05 Spindle stop
M06 Tool change
M08 Coolant on
M09 Coolant off

M10 Chuck - clamping


M11 Chuck - unclamping
M12 Tailstock spindle out

Subject: CNC Technology


Page No:

M13 Tailstock spindle in


M17 Tool post rotation normal
M18 Tool post rotation reverse
M30 End of tape and rewind or main program end
M98 Transfer to subprogram
M99 End of subprogram
Note : On some machines and controls, some may be differ.
4.3.5 Tape Programming Format
Both EIA and ISO use three types of formats for compiling of NC data into suitable blocks of information
with slight difference.
Word Address Format
This type of tape format uses alphabets called address, identifying the function of numerical data
followed. This format is used by most of the NC machines, also called variable block format. A typical
instruction block will be as below :
N20 G00 X1.200 Y.100 F325 S1000 T03 M09 <EOB>
or
N20 G00 X1.200 Y.100 F325 S1000 T03 M09;
The MCU uses this alphabet for addressing a memory location in it.
Tab Sequential Format
Here the alphabets are replaced by a Tab code, which is inserted between two words. The MCU reads the
first Tab and stores the data in the first location then the second word is recognized by reading the record
Tab. A typical Tab sequential instruction block will be as below :
>20 >00 >1.200 >.100 >325 >1000 >03 >09
Fixed Block Format
In fixed block format no letter address of Tab code are used and none of words can be omitted. The main
advantage of this format is that the whole instruction block can be read at the same instant, instead of
reading character by character. This format can only be used for positioning work only. A typical fixed
block instruction block will be as below:
20 00 1.200 .100 325 1000 03 09 <EOB>
4.3.6 Machine Tool Zero Point Setting
The machine zero point can be set by two methods by the operator, manually by a programmed absolute
zero shift, or by work coordinates, to suit the holding fixture or the part to be machined.
Manual Setting
The operator can use the MCU controls to locate the spindle over the desired part zero and then set the X
and Y coordinate registers on the console to zero.

Absolute Zero Shift


The absolute zero shift can change the position of the coordinate system by a command in the CNC
program. The programmer first sends the machine spindle to home zero position by a command in the
program. Then another command tells the MCU how far from the home zero location, the coordinate
system origin is to be positioned.
R = Reference point (maximum travel of machine)
W = Part zero point workpice coordinate system
M = Machine zero point (X0, Y0, Z0) of machine coordinate system
The sample commands may be as follows :
N1 G28 X0 Y0 Z0 (sends spindle to home zero position or Return to reference point).
N2 G92 X3.000 Y4.000 Z5.000 (the position the machine will reference as part zero or Programmed zero
shift).
4.3.7 Coordinate Word
A co ordinate word specifies the target point of the tool movement or the distance to be moved. The word
is composed of the address of the axis to be moved and the value and direction of the movement.
Example
X150 Y-
incremental will have to be defined previously using G-Codes.
4.3.8 Parameter for Circular Interpolation
These parameters specify the distance measured from the start point of the arc to the center. Numerals
following I, J and K are the X, Y and Z components of the distance respectively.
4.3.9 Spindle Function
The spindle speed is commanded under an S address and is always in revolution per minute. It can be
calculated by the following formula :
Surface cutting speed in m/min × 1000 Spindle Speed = π × Cutter Diameter in mm
Example
S1000 represents a spindle speed of 1000 rpm.

4.3.10 Feed Function


The feed is programmed under an F address except for rapid traverse. The unit may be in mm per minute
or in mm per revolution. The unit of the federate has to be defined at the beginning of the programme.
The feed rate can be calculated by the following formula :
Chip Load Feet Rate = Tooth × No. of tooth Spindle speed
Example
F100 represents a feed rate of 100 mm/min.
4.3.11 Tool Function
The selection of tool is commanded under a T address. T04 represents tool number 4.
4.3.12 Work Settings and Offsets
All NC machine tools require some form of work setting, tool setting, and offsets to place the cutter and
work in the proper relationship. Compensation allows the programmer to make adjustments for
unexpected tooling and setup conditions. A retraction point in the Z-axis to which the end of the cutter
retracts above the work surface to allow safe table movement in the X-Y axes. It is often called the rapid-
traverse distance, retract or work plane. Some manufacturers build a workpiece height distance into the
MCU (machine control unit) and whenever the feed motion in the Z-axis will automatically be added to
the depth programmed.
When setting up cutting tools, the operator generally places a tool on top of the highest surface of the
work piece. Each tool is lowered until it just touches the workpiece surface and then its length is recorded
on the tool list. Once the work piece has been set, it is not generally necessary to add any future depth
dimensions since most MCU do this automatically.
Rapid Positioning
This is to command the cutter to move from the existing point to the target point at the fastest speed of the
machine.
Linear Interpolation
This is to command the cutter to move from the existing point to the target point along a straight line at
the speed designated by the F address.

Circular Interpolation
This is to command the cutter to move from the existing point to the target point along a circular arc in
clockwise direction or counter clockwise direction. The parameters of the center of the circular arc is
designated by I, J and K addresses. I is the distance along the X-axis, J along the Y, and K along the Z.
This parameter is defined as the vector from the starting point to the center of the arc.
Circular Interpolation
In NC machining, if the cutter axis is moving along the programmed path, the dimension of the workpiece
obtained will be incorrect since the diameter of the cutter has not be taken in to account. What the system
requires are the programmed path, the cutter diameter and the position of the cutter with reference to the
contour. The cutter diameter is not included in the programme. It has to be input to the NC system in the
tool setting process.
Tool path without cutter compensation

Tool Path with Cutter Compensation

PART PROGRAM FOR LATHE OPERATION


The CNC lathe operation such as simple facing, turning, taper turning, thread, boring, parting off etc. The
X-axis and Z-axis are taken as the direction of transverse motion of the tool post and the axis of the
spindle respectively. To prepare part programs using G-codes and M-codes. The following examples
illustrated the part program for different components.
Example
1 (All dimensions are in mm).

% 1000; (Main programme)


N01 G54 G90 G71 G94 M03 S800; (Parameters
Setting) N05 G01 X-12.5 Z0 F2; (Facing the job)
N10 G00 Z1; (Retrieval of tool)
N15 G00 X00; (Tool clearance)
N20 G01 Z-100; (Starting cut)
N25 G00 X1 Z1; (Clearance position)
N30 G00 X-2; (Position of cut)
N35 G01 Z-60; (Cutting length)
N40 G00 X-1 Z1; (Retrieval of tool)
N45 G00 X-3; (Position of cut)
N50 G01 Z-60; (Cutting length)
N55 G00 X-2 Z1; (Retrieval of tool)
N60 G00 X-4; (Position of cut)
N65 G01 Z-60; (Cutting length)

N70 G00 X-3 Z1; (Retrieval of tool)


N75 G00 X-4.5; (Position of cut)
N80 G01 Z-60; (Cutting length)
N85 G00 X5 Z5; (Final position of tool)
N90 M02; (End of programme)

Example
2 (All dimensions are in mm).
% 2000; (Main programme)
N01 G54 G91 G71 G94 M03 S800; (Parameters Setting)
N05 G01 X-15 Z0 F2; (Facing the job)
N10 G00 Z1; (Tool clearance)
N15 G00 X10; (Tool clearance from the centre)
N20 G01 Z-36; (Turning operation)
N25 G01 X5 –Z30; (Taper turning operation)
N30 G00 X1 Z66; (Final position of tool)
N35 M02; (End of programme)

% 2000; (Main programme)


N01 G91 G71 G94 M03 S800; (Parameters Setting)
N05 G01 X-5 Z0 F1; (Facing the job)
N10 G02 X5 Z-5 I0 K5; (Circular Interpolation)
N15 G00 X6 Z6; (Final position of tool)
N20 M02; (End of programme).

FIXED CYCLE/CANNED CYCLE


Machining holes is probably the most common operation, mainly done on CNC milling machines and
machining centers. Even in the industries traditionally known for their complex parts, such as aircraft and
aerospace components manufacturing, electronics, instrumentation, optical or mold making industries,
machining holes is a vital part of the manufacturing process. Machining on simple hole may require only
one tool but a precise and complex hole may require several tools to be completed. Number of holes
required for a given job is important for selection of proper programming approach. In the majority of
programming applications, hole operations offer a great number of similarities from one job to another.
Hole machining is a reasonably predictable is an ideal subject to be handled very efficiently by a
computer. Several advance technique are used such that a sequence can be programmed just once and
given an identity so that it can be called back into the main programme as and when required. These
sequences are referred to in a number of ways like cycle, subroutines and loops, etc.
A fixed cycle is a combination of machine moves resulting in a particular machining function such as
drilling, milling, boring and tapping. By programming one cycle code number, as many as distinct
movements may occur. These movements would take blocks of programme made without using Fixed or
Canned cycles. The corresponding instructions of a fixed cycle are already stored in the system memory.
The advantages of writing a part programme with these structures are :
(a) Reduced lengths of part programme.
(b) Less time required developing the programme.
(c) Easy to locate the fault in the part programme.
(d) No need to write the same instructions again and again in the programme.
(e) Less memory required in the control unit.
The following examples are some basic and fixed cycle codes available with a number of machines,
assigned by EIA.
Example
01 (G81 Drilling Cycle) (All dimensions are in mm).
R00 – Dwell time at the starting point for chip removal.
R02 – Reference plane absolute with sign.
R03 – Final depth of hole absolute with sign.
R04 – Dwell time at the bottom of drilled hole for chip breaking.
R10 – Retract plane without sign.
R11 – Drilling axis number 1 to 3.
% 400;
N5 G17 G71 G90 G94 G55;
N10 T1 L90;
N15 G00 D5 Z5 M3 S600 X27 Y27;
N20 G81 R02=5, R03=-33, R11=3, F50 M7;
N25 X97;
N30Y97;
N35 X27;
N40 G00 G80 Z100 M9;
N45 M02;
UNIT – III

APT PROGRAMMING:
APT stands for Automatically Programmed Tool. It is a language that defines the tool
path with respect to the part geometry, and often forms the basis for post-processor
generated NC files.
The APT language consists of four types of statements.
Geometry statements will be used to specify the elemental features defining the part
shape.
Motion statements are used to specify the path taken by the tool.
Post-processor statements control the machinery, controlling coolants as well as the
feeds and speeds.
Auxiliary statements complete the picture, specifying the part, required tools, etc. The
following sections describe each of the APT statements.

 Geometry Statements
All geometric elements must be defined before tool motion may be programmed.
Geometry statements associate a symbol with a description of the geometric element and
its parameters. The general form for a geometry statement is:

Symbol = geometric type/parametric description

The symbol consists of up to six alpha-numeric characters, containing at least one alpha
character, and avoiding APT reserved words. The symbols provide a means to name the
geometric features. The equals sign separates the symbol from the geometric type.
The geometric type describes these features.
1. POINT,
2. LINE,
3. PLANE, and
4. CIRCLE are valid APT geometric types. The forward slash character separates the
geometric type from the parametric description of the feature.
The parametric description specifies the location and size of the feature. It may include
dimensional data, positional data, and other APT words relating the feature to previously
defined APT symbols. The APT language provides a rich means to specify the geometry,
as is evidenced by the following examples.
1. To specify a point:
P0 = POINT/1.0, 1.2, 1.3 specifies a point at XYZ coordinates 1.0, 1.2, and 1.3,
respectively.
P1 = POINT/INTOF L1, L2 specifies a point at the intersection of lines L1 and L2,
which must have been defined prior to the statement.
P2 = POINT/YLARGE, INTOF, L3, C1 specifies a point at the intersection of line L3
and circle C1 at a Y position above the center point of the circle.

2. To specify a line:
L1 = LINE/P0, P1 specifies a line by two points, previously defined.
L1 = LINE/1.0, 1.2, 1.3, 2.0, 2.1, 2.3 specifies a line by two points, given as explicit
coordinates.
L2 = LINE/P2, PARLEL, L1 specifies a line through point P2 and parallel to line L1.
L3 = LINE/P1, RIGHT, TANTO, C1 specifies a line through point P1 and tangent to
circle C1 on the right side of the center point.
L4 = LINE/P1, ATANGL, 45, L1 specifies a line through point P1 at an angle of 45o to
line L1.
3. To specify a plane:
PL0 = PLANE/P0, P1, P2 specifies a plane through three, non-colinear, previously
defined points.
PL1 = PLANE/P3, PARLEL, PL0 specifies a plane through a point P3 parallel to a
plane PL0.

4. To specify a circle:
C0 = CIRCLE/CENTER, P0, RADIUS, 1.0 specifies a circle of radius 1 from a center
point of P0.
Lines and planes extend infinitely. Circles are always complete. The same geometry may
be defined only once, and may not have more than one symbol.

 Motion Statements
The format for motion commands follows the pattern:

Motion/description

The initial motion starts from a home position, and takes the form:
FROM/P0 or FROM/ 0.0, 1.0, 2.0
The FROM motion statement occurs only once for each set of a motion type, at the start
of the set of motions.
Contouring motion – is the most common motion used in APT programming, and these
statements specify the tool path continuously throughout the motion. They make use of
three surfaces: (a) drive; (b) check; and (c) part surfaces.
Drive surfaces represent the surface along which the vertical edges of the tool will follow.
Part surfaces specify the surfaces the tip of the tool will follow. And check surfaces
describe where the tool will come to rest after it has completed the motion of the current
step. There are four locations for the tool to stop with respect to a check surface. These
four possibilities each have their own modifier words.
The TO modifier stops the tool when the first surface of the tool would come into
contact with the check surface. The ON modifier stops the tool where the center point of
the tool would come into contact with the check surface. The PAST modifier stops the
tool where the last surface of the tool would contact the check surface. And the TANTO
modifier stops the tool at the point of circular tangency with the edge of the tool.
The initial contouring motion statement is the GO/TO, which defines the initial drive,
part and check surfaces. It takes the form:
GO/TO, drive surface, TO, part surface, TO, check surface
An example would be:
GO/TO, L1, TO, PL1, TO, L2 specifying that the tool should use line L1 as the drive
surface, plane P1 as the part surface, and line L2 as the check surface.
Note: the GOTO and the GO/TO statements are not the same. The former specifies
point to point motion (see below), and the latter initiates contouring motion.
Continuing contouring motion statements are given from the vantage point of a person
sitting on the top of the tool. The motion words are: (a) GOLFT; (b) GORGT; (c)
GOFWD; (d) GOBACK; (e) GOUP; and (f) GODOWN. The sense of these words
depends on the direction the tool has been coming from, and is depicted in Figure 2:

Figure 1. Motion Continuation Statements


Point to point motion – may be specified as absolute, or as incremental (relative to the
last point visited). An example of absolute, point to point motion is:
GOTO/P0
An example of incremental, point to point motion is:
GODLTA/1.0, 2.0, 3.0
Point to point motion is useful in peck drilling or similar operations, since the motion
path in-between the points are unimportant.

 Post-Processor Statements
These statements provide processing parameters to the post-processor program. Typical
programs will require parameters for feeds, speed, and other tool/spindle/machine
controls. Examples:
SPINDL/600 specifies the spindle to be 600 rpm.
FEDRAT/6.0 specifies a feed rate of 6 inches per minute.
TURRET/T2 specifies loading tool # 2 in the turret.
A final post-processor statement must specify to the post-processor program what type of
machine is intended for the final NC code, and the specific controller to generate the code
for. An example is:
MACHIN/MILL, 2 specifies a mill machine type, and controller type 2

 Auxiliary Statements
These statements complete the APT programming language, and include the FINI
statement to mark the end of the program as well as statements to define the width of the
tool. An example of the latter is:
CUTTER/0.25 specifies a quarter-inch cutter diameter.
The computer would then know to calculate a 0.125 inch offset to accommodate the
cutter diameter in computing the center of the tool.
Example APT Problem:
An APT program for the profiling of the part in Figure 2 is to be generated. The
processing parameters are: (a) feed rate is 5.39 inches per minute; (b) spindle speed is 573
revolutions per minute; (c) a coolant is to be used to flush the chips; (d) the cutter
diameter is to be 0.5 inches, and (e) the tool home position is (0, -1, 0).
Figure 3. APT Geometry and Tool Path for Workpiece

Figure 3. APT Geometry and Tool Path for Work piece


APT Program Listing
PARTNO EXAMPLE labels the program “EXAMPLE”
MACHIN/MILL, 1 selects the target machine and controller type
CUTTER/0.5000 specifies the cutter diameter
P0 = POINT/0, -1.0, 0
P1 = POINT/0, 0, 0
P2 = POINT/6.0, 0, 0
P3 = POINT/6.0, 1.0, 0
P4 = POINT/2.0, 4.0, 0 geometry statements to specify the
L1 = LINE/P1, P2 pertinent surfaces of the part
C1 = CIRCLE/CENTER, P3, RADIUS, 1.0
L2 = LINE/P4, LEFT, TANTO, C1
L3 = LINE/P1, P4
PL1 = PLANE/P1, P2, P3
SPINDL/573 sets the spindle speed to 573 rpm
FEDRAT/5.39 sets the feed rate to 5.39 ipm
COOLNT/ON turns the coolant on
FROM/P0 gives the starting position for the tool
GO/PAST, L3, TO, PL1, TO, L1 initializes contouring motion; drive, part, and check
surfaces
GOUP/L3, PAST, L2
GORGT/L2, TANTO, C1 motion statements to contour the part
GOFWD/C1, ON, P2 in a clockwise direction
GOFWD/L1, PAST, L3
RAPID move rapidly once cutting is done
GOTO/P0 return to the tool home position
COOLNT/OFF turn the coolant off
FINI end program
APT Vocabulary
The APT programming language has over 400 words. The Chapter 6 Appendix in the
Groover text (pp. 196 – 209) lists several useful words. It is suggested that the diligent
student review this appendix, and note the particularly useful/trickier words in her/his
engineering notebook.
NC Part Programming on CAD/CAM
A CAD/CAM system is a computer interactive graphics system equipped with software is
accomplish certain tasks in design and manufacturing and to integrate the design and
manufacturing functions. We discuss ('AD/CAM in Chapter 24. One of the important
tasks performed on a CAD/CAM system is NC part programming. In this method of part
programming, portions of the procedure usually done by the part programmer are instead
done by the computer. Recall that the two main tasks of the part programmer in computer
assisted programming are (1) defining the part geometry and (2) specifying the tool path.
Advanced CAD/CAM systems automate portions of both of these tasks.
Geometry Definition Using CAD/CAM. 
A fundamental objective of CAD/CAM is to integrate the design engineering and
manufacturing engineering functions. Certainly one of the important design functions is
to design the individual components of the product. If a CAD/e' AM system is used, a
computer graphics model of each part is developed by the designer and stored in the
CAD/CAM data base. That model contains all of the geometric, dimensional, and
material specifications for the part.
When the same CAD/CAM system, or a CAM system that has access to the same CAD
data base in which the part model resides, is used to perform NC part programming, it
makes little sense to recreate the geometry of the part during the programming procedure.
Instead, the programmer has the capability to retrieve the part geometry model from
storage and to use that model to construct the appropriate cutter path. The significant
advantage of using CAD/CAM in this way is that it eliminates one of the tirne
consurming steps in computer assisted part programming: geometry definition. After the
part geometry has been retrieved, the usual procedure is to label the geometric elements
that will be used during part programming. These labels are the variable names (symbols)
given to the lines, circles and surfaces that comprise the part. Most systems have the
capacity to automatically label the geometry elements of the part and to display the labels
on the monitor. The programmer can then refer to those labeled elements during tool path
construction.
If the NC programmer does not have access to the data base, then the geometry of the part
must be defined. This is done by using similar interactive graphics techniques that the
product designer would use to design the part. Points are defined in a coordinate system
using the computer graphics system, lines and circles are defined from the points,
surfaces are defined. And so forth, to construct a geometric model of the part. The
advantage of using the interactive graphics system over conventional computer assisted
part programming is that the programmer receives immediate visual verification of the
definitions being created. This tends to improve the speed and accuracy of the geometry
definition process
Tool Path Generation Using CAD/CAM. 
The second task of the NC programmer in computer assisted part programming is tool
path specification, the first step in specifying the tool path is La select the cutting tool for
the operation. Most CADICAM systems have tool libraries that can be called by the
programmer to identify what tools are available in the tool crib. The programmer must
decide which of the available tools is must appropriate for the operation under
consideration and specify it for the tool path. This permits the tool diameter and other
dimensions to be entered automatically for tool offset calculations. If the desired cutting
tool is not available in the library, an appropriate tool can be specified by CNC
programmer. It then becomes part of the library for future use
The next step is tool path definition. There are differences in capabilities of the various
CAD/CAM systems, which result in different approaches fur generating the tool path.
The most basic approach involves the use of the interactive graphics system to enter the
motion commands cnebyone.uirnilar to computer assisted part programming. Individual
statements in APT or other part programming language are entered. And the CAD/CAM
system provides an immediate graphic display of the action resulting from the command.
There by validating the statement.
A more advanced approach for generating tool path commands is to use one of the
automatic software modules available on the CAD/CAM system. These modules have
been developed to accomplish a number of common machining cycles for milling,
drilling, and turning. They are subroutines in the NC programming package that can be
called and the required parameters given to execute the machining cycle. Several of these
modules are identified in Table 6.13 and Figure 6.25.
When the complete part program has been prepared, the CAD/CAM system can provide
an animated simulation of the program for validation purposes.
Computer Automated Part Programming. In the CAD/CA M approach to NC part
programming, several aspects of the procedure are automated. In the future, it should be
possible to automate the complete NC part programming procedure. We are referring to
this fully automated procedure as computer automated part programming. Given the
geometric model of a part that has been defined during product design, the computer
automated system would possess sufficient logic and decision-making capability to
accomplish NC part programming for the entire part without human assistance.
This can most readily be done for certain NC processes that involve well defined,
relatively simple part geometries. Examples are point to point operations such as NC
drilling and electronic component assembly machines. In these processes, the program
consists basically of a series of locations in an xy coordinate system where work is to be
performed [e.g . holes arc to be drilled or components are to be inserted). These locations
are determined by data that are generated during product design. Special algorithms can
be developed to process the design data and generate the NC program for the particular
system. "fe contounag systems will eventually be capable at a similar level of automation.
Automatic programming of this type is closely related to computer-automated process
planning (CAPP), discussed in later pages.
What is a CNC Post Processor?
We’ve seen that there are many dialects of G-Code. CAM software has to take geometry
from a CAD model and convert it to g-code. Doing so obviously requires an awareness of
the exact g-code dialect that is being targeted. The Post Processor is the component of
your CAM software that is responsible for translating to the exact g-code dialect. We
often refer to a particular instance of a translation as a “Post”. There will be a different
Post for each g-code dialect your CAM software supports. While translation to specific g-
code dialects is the primary task of a Post Processor, they can do a lot more besides to
customize your part programs to work using the Best Practices of your shop. For
example, you might use a 4th axis in a certain way, but you don’t use the 4th axis for
every job. It might make sense to have one Post for standard jobs and another for 4th
Axis jobs. The Post can change the initial setup of a part program and it can change how
particular operations work. Another example might be a post that automatically
substitutes a deep hole drilling cycle whenever the length to diameter ratio of the hole is
too large.
We’ll talk in greater length about some of these other possibilities below. First, let’s
understand the translation role better.

CNC Post Processor Schematic Overview


Every CAM package has a post processor. It’s purpose is to allow the CAM to work for
more than one g-code dialect.  Post Processors don’t convert g-code from one dialect to
the next. Instead they use an intermediate format that captures the CNC machine’s
movements.
 
The intermediate format is “CL Data.” CL Data bears no resemblance to g-code The
“CL” stands for “Cutter Location.”  There are many formats for CL Data files but one
common format is “APT”.
 
If you think about it, deciding cutter locations is what CAM does. Here’s a schematic
overview of what’s happening:

What is a CNC Post Processor?


CAM software starts with a CAD Model of the part. It analyzes the CAD model to
determines wha the toolpaths should be. Then, it outputs the toolpaths as a CL Data file.
 
You seldom see the CL Data, because it isn’t necessary. But CL Data is accessible in
many CAM packages for use by utility software such as simulators.
 
The Post Processor grabs the CL Data and converts it to g-code. A little file called the
“Post” controls the Post Processor. The Post gives the “recipe” for converting CL Data to
a particular g-code dialect you’ve targeted.

CL Data, Simulators, and the Reason to Use a G-Code Simulator


Most CAM packages include a simulator of some sort that’s able to display a simulation
of the tool cutting a part. These simulations are often quite impressive, and they’re useful.
But they also have a critical weakness. 99% of the time the simulation uses the CL Data,
not on the G-Code the CNC machine will actually be executing.
 
Using CL Data hides any bug in the Post Processor or the Post recipe. The simulator can’t
show what your CNC machine will do. The simulation can look perfect, but then you’ll
have a problem when you go to run the part program on your machine.
This is why the Best Practice is to run all CAM-generated g-code through a g-code
simulator. It’s like getting a second opinion from an alternate doctor, and it can save you
a lot of time and trouble at very low cost.
 
Our G-Wizard Editor software is a great example of a g-code simulator. Our customers
tell us it saves them from problems that otherwise would’ve turned up on the machine.
You must be wondering, “Is CAM software really that buggy that we can’t trust the built-
in simulator?” In most cases, it isn’t a function of major bugs but rather of little issues
that go undiscovered. Perhaps the simulation looks fine but there’s something wrong in
the g-code that will cause an alarm on your CNC machine so it just won’t execute. That’s
time wasted running back and forth between machine and CAM trying to figure out the
cause of the alarm and how to fix it.
A good g-code simulator does a lot more than just plot the toolpath–it will check for all
sorts of alarm conditions.

CNC Post Processors for Shop Best Practices


While the primary role of a Post is to convert generic geometry to the particular dialect of
G-Code your machine uses, the Post also gives you a lot of flexibility to tailor your CAM
output to the practices your shop likes to use, so it is a handy way to customize the G-
Code output of your CAM.
If you frequently are making the same hand edits over and over again to your G-Code,
it’s worth investigating whether a change to your Post would eliminate that hassle. Some
examples of shop-specific customization might include your standards for safety blocks
or required comments.
You can even modify the Post to save your operators some time. Maybe you want the
table on your mill to move as close to the enclosure door as possible at the end of a job to
facilitate loading and unloading. That’s a logical thing to have the Post do for you.
Depending on the CAM package and its Post capabilities, sometimes very powerful
flexibility is an option. For example, the Post may be able to popup a custom menu
allowing you to choose some options you’ve specifically designed for your shop’s needs
on every Post.
Introduction to CAD/CAM software
CAD/CAM Technology:
The story of CAD/CAM was accelerated in early 1950s. Up to year 2012ithas become
one of the supreme technology available on Planet earth. It is being used in almost all the
fields of engineering but primarily in mechanical engineering branches. The development
in the field is still gaining speed.
 CAD Technology = Design Techniques + Computers.

 The CAD Process is the subset of the Design process.

 The CAM Process is a subset of Manufacturing Process.

 Integration of CAD and CAM leads to automation. (as show below)


Computer Aided Design (CAD):
In general, a Computer Aided Design (CAD) package has three components: a) Design,
b) Analysis, and c) Visualization, as shown in the sketch. A brief description of these
components follows.
a) Design: Design refers to geometric modeling, i.e. 2-D and 3-D modeling, including,
drafting, part creation, creation of drawings with various views of the part, assemblies of
the parts, etc.
b) Analysis: Analysis refers to finite element analysis, optimization, and other number
crunching engineering analyses. In general, a geometric model is first created and then
the model is analyzed for loads, stresses, moment of inertia, and volume, etc.
c) Visualization: Visualization refers to computer graphics, which includes: rendering a
model, creation of pie charts, contour plots, shading a model, sizing, animation, etc.
Each of these three areas has been extensively developed in the last 30 years. Several
books are written on each of these subjects and courses are available through the
academic institutions and the industry.
Most commercial CAD packages (software) consist of only a single component: design or
analysis or visualization. However, a few of the vendors have developed an integrated
package that includes not only these three areas, but also includes the manufacturing
software (CAM). Due to the large storage requirement, integrated packages use either an
UNIX workstation or a mainframe platform, and not the popular PC platform. With the
improvement in PC computing speed, it’s only a matter of time before we see an
integrated package run on a PC. CAD has revolutionized the modern engineering
practice; small and large companies use it alike, spending several billion dollars for the
initial purchase or lease alone. CAD related jobs are high in demand and the new
graduates have advantage over their senior colleagues, as they are more up to date and
more productive.
Computer Aided Manufacturing (CAM):
CAM is the next stage of CAD. A part created in CAD can be downloaded and
manufactured, without a human hand touching the part. The process is called CAM, and
involves CAD, Networking, and NC programming, as shown below.
Design Process:
The process of Design is segmented into Six Stages, details of which have been shown in
below figure .The design process is repetitive as well as creative. The repetitive tasks can
be performed by computers; however, the creative tasks (stages 1 and 2) are always done
only on the human being. Show in this figure.
Stage1: Recognizing the fact that there is a need for a new product for intended function.
It may also include the modification in the existing product.
Stage2: Problem is fully defined in terms of functionality and meeting other requirements
such as ergonomic, performance-data, statutory, etc.
Stage3: The design undergoes synthesis, joining its various elements.
Stage4: Product analysis reveals the weaknesses and thus weaknesses can be considered
for improvement. This process is repeated until an acceptable Design achieved.
Stage5: The optimized Design is reviewed from the point of view of expected
performance. It can be done through proto-type modeling and testing against the set
standard.
Stage6: Stages 4 and 5 are repeated until acceptable, optimized design is achieved. These
stages are basically iterative in-nature. Iteration depends on the creativeness, ingenuity
(skill for devising) and experience of designers and the software (tools) available. The
process (stage 1 and 2) are human dependent while the stages 3, 4, 5 and 6 (four stages)
are computer based (CAD).
(A) Geometric modeling: - It implies the existence of a computer graphics screen and
some interaction with the computer to generate the geometry and topology of the part.
(B) Engineering analysis: - Communicates with the data base to retrieve the part
description and with the user to obtain the design constraints, boundary conditions, and
other details of the analysis.
(C) Evaluation module: - Allows the user to check the correctness, manufacturability,
and processing details of the part.
(D) The drafting and documentation module: - Contains some of both the oldest and
newest technologies/Computer plotting of engineering drawings.

CAD Software:
CAD software is written in FORTRAN and C languages. FORTRAN provides the
number crunching, whereas, C language provides the visual images. Early CAD packages
were turnkey systems, i.e., the CAD packages were sold as an integrated software and
hardware package, with no flexibility for using second vendor hardware (1970s and 80s).
These systems were based on 16-bit word, and were incapable of networking. The
modern CAD software utilizes the open architecture system, i.e., software vendors do not
design and manufacture their own hardware. Third party software can be used to augment
the basic CAD package. Most popular CAD package will facilitate integration of the
Finite Element Analysis and other CAD software from more than one vendor. For
example, IDEAS preprocessor can work with almost all the FEA packages for pre and
post analyses.

Networking is an important consideration in applications of CAD software. A model


created by one engineer must be readily accessible to others in an organization, which is
linked by a LAN or other means. The designer, analyst, management, marketing, vendor,
and others generally share a model. This is the concurrent engineering in action,
mentioned earlier.
2. Computer Graphics: - Computer graphics is the computer-to-user communication
medium used in computer-aided design and drafting systems. An object's definition is
primarily geometric; it is convenient to be able to display the geometry of the part on a
computer screen or from any given viewing angle in a variety of sizes. This section
explains techniques for 2-D and 3-D graphics and realistic image generation
2.1. Interactive Graphics: - Interactive computer graphics is used in five different areas:
(1) to modify the display, i.e., to change the view, type of projection, or object attributes
and such as color, line type line style, surface type, rotation angle
(2) For data entry and data modification
(3)In command and monitoring
(4) For simulation and
(5) For design.
2.2 Graphics in CAD: - Every problem in computer graphics and, therefore, in has three
major parts an application, hardware and software. a) An application: Is a; software
program written by user writ specific purpose mind. One application would computer-
aided drafting. Another application may be finite-element analysis or circuit design. In
any case, the application is specific to the particular use intended for the graphics system
or for the computer-aided design system. b) Hardware: Modern computer graphics
displays are simple in construction.
They consist of basically three components.
1- Monitor 2- Digital Memory 3- Display Controller.
Most of the computer graphics displays use CRT which is a matrix of discrete cells each
of which can be made bright. A graphic entity like line or circle is represented as a series
of "points or dots" on the screen.

c) Software: Includes the programs necessary to receive-graphical data and put the
required image on the screen. The image may be as simple as a 2-D wireframe, or as
complex as 3-D. The graphics software in the program receives geometric primitives such
as lines, points, and surfaces and paints them on the screen or on the output device
according to the object attributes. The result of this three-step process (application,
hardware, and software) is graphical output.

The layers of a CAD graphics program


2.3. Two-Dimensional Graphics: - In order to draw 2-D images on the display, there
must be at least two functions or subroutines available in the basic graphics package. The
first is a MOVE (X.Y) subroutine, which moves the pen to an (x, y) location without
drawing (with the pen up case of the plotter, or the beam off in the case of a CRT). The
second command is the LINE(X,Y) subroutine, which moves the beam to an (x, y)
location with the pen down, thus drawing a line. Alternative specific instances of these
commands appear in various graphics packages.
2.4. Three-Dimensional Graphics: - In the case of three-dimensional graphics, a z
coordinate is added to all points. Rotations must deal with angles around the x, y, and z
axes instead of just the z axis. The following sections will discuss operations necessary to
start with a three-dimensionally fined object, place it in space in the correct location, and
draw it on a two-dimensional output device. The concepts involve three-dimensional
transformations, perspective and orthographic projections, viewing transforms, and
window-to-viewport mapping, all in three dimensions.
UNIT - V
What is a Microcontroller?
A microcontroller is a small, low-cost and self contained computer-on-a-chip that can be used as an
embedded system. A few microcontrollers may utilize four-bit expressions and work at clock rate
frequencies, which usually include:

 An 8 or 16 bit microprocessor.
 A little measure of RAM.
 Programmable ROM and flash memory.
 Parallel and serial I/O.
 Timers and signal generators.
 Analog to Digital and Digital to Analog conversion

Even at a time when Intel presented the first microprocessor with the 4004 there was already a demand for
microcontrollers: The contemporary TMS1802 from Texas Instruments, designed for usage in calculators, was by
the end of 1971 advertised for applications in cash registers, watches and measuring instruments. The TMS 1000,
which was introduced in 1974, already included RAM, ROM, and I/O on-chip and can be seen as one of the first
microcontrollers, even though it was called a microcomputer. The first controllers to gain really widespread use
were the Intel 8048, which was integrated into PC keyboards, and its successor, the Intel 8051, as well as the
68HCxx series of microcontrollers from Motorola. Today, microcontroller production counts are in the billions
per year, and the controllers are integrated into many appliances we have grown used to, like
• Household appliances (microwave, washing machine, coffee machine, . . . )
• Telecommunication (mobile phones)
• Automotive industry (fuel injection, ABS, . . . )
• Aerospace industry
• Industrial automation

5.2. Hardware components of Microcontroller:


You might have seen the basic structure of a Microcontroller many times. If you have already seen the
structure of Microcontroller and the basic components of a Microcontroller before, then consider this as
a revision. If you haven’t seen it, then it is very important to get an idea about the basic structure of a
Microcontroller.

The following image shows the Basic Structure of a Microcontroller.


From the above image, you can understand that the three important (or major) components of a
Microcontroller are:
The CPU (Central Processing Unit)
The Memory and
The I/O Ports
This doesn’t mean that other components are of less importance. But these can be considered as
supporting devices. We will now see each of the Basic Components of a Microcontroller mentioned in
the above structure.
CPU
Central Processing Unit or CPU is the brain of the Microcontroller. It consists of an Arithmetic Logic
Unit (ALU) and a Control Unit (CU). A CPU reads, decodes and executes instructions to perform
Arithmetic, Logic and Data Transfer operations.
Memory
Any Computational System requires two types of Memory: Program Memory and Data Memory.
Program Memory, as the name suggests, contains the program i.e. the instructions to be executed by the
CPU. Data Memory on the other hand, is required to store temporary data while executing the
instructions.
Usually, Program Memory is a Read Only Memory or ROM and the Data Memory is a Random Access
Memory or RAM. Data Memory is sometimes called as Read Write Memory (R/W M).
I/O Ports
The interface for the Microcontroller to the external world is provided by the I/O Ports or Input/Output
Ports. Inputs device like Switches, Keypads, etc. provide information from the user to the CPU in the
form of Binary Data.
The CPU, upon receiving the data from the input devices, executes appropriate instructions and gives
response through Output Devices like LEDs, Displays, Printers, etc.
Bus
Another important component of a Microcontroller, but rarely discussed is the System Bus. A System
bus is a group of connecting wire that connects the CPU with other peripherals like Memory, I/O Ports
and other supporting components.
Timers/Counters
One of the important components of a Microcontroller is the Timers and Counters. They provide the
operations of Time Delays and counting external events. Additionally, Timers and Counters can provide
Function Generation, Pulse Width Modulation, Clock Control, etc.
Serial Port
One of the important requirements of a Microcontroller is to communicate with other device and
peripherals (external). Serial Port proves such interface through serial communication. Most common
serial communication implemented in Microcontrollers is UART.
Interrupts
A very important feature of a Microcontroller is Interrupts and its Interrupt Handling Mechanism.
Interrupts can be external, internal, hardware related or software related.
ADC (Analog to Digital Converter)
Analog to Digital Converter or ADC is a circuit that converts Analog signals to Digital Signals. The
ADC Circuit forms the interface between the external Analog Input devices and the CPU of the
Microcontroller. Almost all sensors are analog devices and the analog data from these sensors must be
converted in to digital data for the CPU to understand.
DAC (Digital to Analog Converter)
Digital to Analog Converter or DAC is a circuit, that works in contrast to an ADC i.e. it converts Digital
Signals to Analog Signals. DAC forms the bridge between the CPU of the Microcontroller and the
external analog devices.
Advantages of Microcontrollers
 A Microcontroller is a true device that fits the computer-on-a-chip idea.
 No need for any external interfacing of basic components like Memory, I/O Ports, etc.
 Microcontrollers don’t require complex operating systems as all the instructions must be written
and stored in the memory. (RTOS is an exception).
 All the Input/Output Ports are programmable.
 Integration of all the essential components reduces the cost, design time and area of the product
(or application).
Disadvantages of Microcontrollers
 Microcontrollers are not known for their computation power.
 The amount of memory limits the instructions that a microcontroller can execute.
 No Operating System and hence, all the instruction must be written.
Applications of Microcontrollers
There are huge numbers of applications of Microcontrollers. In fact, the entire embedded systems
industry is dependent on Microcontrollers. The following are few applications of Microcontrollers.
 Front Panel Controls in devices like Oven, washing Machine etc.
 Function Generators
 Smoke and Fire Alarms
 Home Automation Systems
 Automatic Headlamp ON in Cars
 Speed Sensed Door Locking System

5.3. EXTERNAL MEMORY INTERFACING


Data Memory: For longer term storage, generic CPUs usually employ an external memory which is much
larger than the register file. Data that is stored there may be short-lived, but may also bevalid for as long as
the CPU is running. Of course, attaching external memory to a CPU requiressome hardware effort and thus
incurs some cost. For that reason, microcontrollers usually sport on-chip data memory.
Eg. Interfacing of 16 K Byte of RAM and 32 K Byte of EPROM to 8051 Number of address lines required for
16 Kbyte memory is 14 lines and that of 32Kbytes of memory is 15 lines. The connections of external memory is
shown below
The lower order address and data bus are multiplexed. De-multiplexing is done by the latch. Initially the address
will appear in the bus and this latched at the output of latch using ALE signal. The output of the latch is directly
connected to the lower byte address lines of the memory. Later data will be available in this bus. Still the latch
output is address it self. The higher byte of address bus is directly connected to the memory. The number of lines
connected depends on the memory size.

The RD and WR (both active low) signals are connected to RAM for reading and writing the data.
PSEN of microcontroller is connected to the output enable of the ROM to read the data from the memory.
EA (active low) pin is always grounded if we use only external memory. Otherwise, once the program size
exceeds internal memory the microcontroller will automatically switch to external memory.
Instruction Memory:
Like the data memory, the instruction memory is usually a relatively large external memory (at least with
general CPUs). Actually, with von-Neumann-architectures, it may even be the same physical memory as the
data memory. With microcontrollers, the instruction memory, too, is usually integrated right into the MCU.
These are the most prominent uses of memory in or around a CPU. However, there is more memory
in a CPU than is immediately obvious. Depending on the type of CPU, there can be pipeline registers,
caches, various buffers, and so on. About memory embedded in an MCU: Naturally, the size of such on-chip
memory is limited. Even worse, it is often not possible to expand the memory externally (in order to keep the
design simple). However, since MCUs most often are used for relatively simple tasks and hence do not need
excessive amounts of memory, it is prudent to include a small amount of data and instruction memory on the
chip. That way, total system cost is decreased considerably, and even if the memory is not expandable, you
are not necessarily stuck with it: Different members in a MCU family usually provide different amounts of
memory, so you can choose a particular MCU which offers the appropriate memory space. Now, the
functional distinction of memory types made above is based on the way the memory is used. From a
programmer’s perspective, that makes sense. However, hardware or chip designers usually view memory
rather differently: They prefer to distinguish according to the physical properties of the electronic parts the
memory is made of. There, the most basic distinction would be volatile versus non-volatile memory. In this
context, volatile means that the contents of the memory are lost as soon as the system’s power is switched
off. Of course, there are different ways either type of memory can be implemented. Therefore, the distinction
based on the physical properties can go into more detail. Volatile memory can be static or dynamic, and there
is quite a variety of non-volatile memory types: ROM, PROM, EPROM, EEPROM, FLASH, and NV-RAM.
Let’s examine those more closely.

5.4. COUNTERS
Each timer is basically a counter which is either incremented or decremented upon every clock tick. The
direction (up- or down-counter) is either fixed or configurable. The current count value can be read through a
count register and can be set to a specific value by the user. For a timer resolution of n, the count value is
within [0, 2n − 1]. Care must be taken when the timer length exceeds the word length of the controller, e.g.,
when using a 16-bit timer on an 8-bit controller. In such a case, access to the 16-bit count value must be done
in two passes, which could lead to inconsistent values. Just think of a timer that is at value 0x00FF and will
switch to 0x0100 in the next cycle. If you read the high byte first and the low byte with the next instruction,
you will get 0x0000. If you do it the other way round, you will end up with 0x01FF, which is not any better.
To counter such problems, the ATmega16 controller for example uses a buffer register to store the high byte
of the timer. So whenever the program reads the low byte of the count register, the high byte is
simultaneously stored in the buffer and can then be read at the next cycle. Likewise, to write a new count
value, the high byte should be written first (and is stored in the buffer by the controller), and as soon as the
low byte is written, both high and low byte are written into the count register in one go.
Timers can generally raise an interrupt whenever they experience an overflow of the count value. This can be
used to implement a rudimentary periodic signal by setting the count value to a given start value and then
waiting for the overflow. However, this method does not give an accurate period because after the overflow
the timer has to be set to its starting value by the program. In consequence, the time from the overflow until
the start value has been reloaded into the timer must either be considered or incorporated into the start value,
or the period will be longer than desired. To avoid this drawback, some timers provide a modulus mode
which automatically reloads the start value when the timer overflows. Another method for getting accurate
periods is to use the PWM feature we will describe shortly. Although the timer is generally clocked by the
same source as the microcontroller itself, this need not be the case. Microcontrollers may allow one or more
of the following sources for clocking the timer.

5.5. TIMERS:
Timers/Counters are used generally for
 Time reference
 Creating delay
 Wave form properties measurement
 Periodic interrupt generation
 Waveform generation

8051 has two timers, Timer 0 and Timer 1.

Timer in 8051 is used as timer, counter and baud rate generator. Timer always counts up irrespective of whether it
is used as timer, counter, or baud rate generator: Timer is always incremented by the microcontroller. The time
taken to count one digit up is based on master clock frequency.
If Master CLK=12 MHz,
Timer Clock frequency = Master CLK/12 = 1 MHz
Timer Clock Period = 1micro second
This indicates that one increment in count will take 1 micro second.

The two timers in 8051 share two SFRs (TMOD and TCON) which control the timers, and each timer also has
two SFRs dedicated solely to itself (TH0/TL0 and TH1/TL1).
The following are timer related SFRs in 8051.
SFR Name Description SFR Address
TH0 Timer 0 High Byte 8Ch
TL0 Timer 0 Low Byte 8Ah
TH1 Timer 1 High Byte 8Dh
TL1 Timer 1 Low Byte 8Bh
TCON Timer Control 88h
TMOD Timer Mode 89h

Embedded System
An embedded system can be thought of as a computer hardware system having software embedded in it. An
embedded system can be an independent system or it can be a part of a large system. An embedded system is a
microcontroller or microprocessor based system which is designed to perform a specific task. For example, a fire
alarm is an embedded system; it will sense only smoke. An embedded system has three components –
 It has hardware.
 It has application software.
 It has Real Time Operating system (RTOS) that supervises the application software and provide mechanism to
let the processor run a process as per scheduling by following a plan to control the latencies. RTOS defines the
way the system works. It sets the rules during the execution of application program. A small scale embedded
system may not have RTOS.
So we can define an embedded system as a Microcontroller based, software driven, and reliable, real-time
control system.
Characteristics of an Embedded System
 Single-functioned − An embedded system usually performs a specialized operation and does the same
repeatedly. For example: A pager always functions as a pager.
 Tightly constrained − All computing systems have constraints on design metrics, but those on an embedded
system can be especially tight. Design metrics is a measure of an implementation's features such as its cost, size,
power, and performance. It must be of a size to fit on a single chip, must perform fast enough to process data in
real time and consume minimum power to extend battery life.
 Reactive and Real time − Many embedded systems must continually react to changes in the system's
environment and must compute certain results in real time without any delay. Consider an example of a car cruise
controller; it continually monitors and reacts to speed and brake sensors. It must compute acceleration or de-
accelerations repeatedly within a limited time; a delayed computation can result in failure to control of the car.
 Microprocessors based − It must be microprocessor or microcontroller based.
 Memory − It must have a memory, as its software usually embeds in ROM. It does not need any secondary
memories in the computer.
 Connected − It must have connected peripherals to connect input and output devices.
 HW-SW systems − Software is used for more features and flexibility. Hardware is used for performance and
security.
Basic Structure of an Embedded System
The following illustration shows the basic structure of an embedded system –

 Sensor − It measures the physical quantity and converts it to an electrical signal which can be read by
an observer or by any electronic instrument like an A2D converter. A sensor stores the measured
quantity to the memory.
 A-D Converter − An analog-to-digital converter converts the analog signal sent by the sensor into a
digital signal.
 Processor & ASICs − Processors process the data to measure the output and store it to the memory.
 D-A Converter − A digital-to-analog converter converts the digital data fed by the processor to
analog data
 Actuator − An actuator compares the output given by the D-A Converter to the actual (expected)
output stored in it and stores the approved output.

Types of Embedded Systems


Embedded systems can be classified into different types based on performance, functional requirements and
performance of the microcontroller.
Types of Embedded systems
Embedded systems are classified into four categories based on their performance and functional
requirements:
 Stand alone embedded systems

 Real time embedded systems


 Networked embedded systems

 Mobile embedded systems

Embedded Systems are classified into three types based on the performance of the microcontroller such as
 Small scale embedded systems

 Medium scale embedded systems

 Sophisticated embedded systems

Stand Alone Embedded Systems


Stand alone embedded systems do not require a host system like a computer, it works by itself. It takes the
input from the input ports either analog or digital and processes, calculates and converts the data and gives
the resulting data through the connected device-Which either controls, drives and displays the connected
devices. Examples for the stand alone embedded systems are mp3 players, digital cameras, video game
consoles, microwave ovens and temperature measurement systems.
Real Time Embedded Systems
A real time embedded system is defined as, a system which gives a required o/p in a particular time. These
types of embedded systems follow the time deadlines for completion of a task. Real time embedded systems
are classified into two types such as soft and hard real time systems.
Networked Embedded Systems
These types of embedded systems are related to a network to access the resources. The connected network
can be LAN, WAN or the internet. The connection can be any wired or wireless. This type of embedded
system is the fastest growing area in embedded system applications. The embedded web server is a type of
system wherein all embedded devices are connected to a web server and accessed and controlled by a web
browser. Example for the LAN networked embedded system is a home security system wherein all sensors
are connected and run on the protocol TCP/IP
Mobile Embedded Systems
Mobile embedded systems are used in portable embedded devices like cell phones, mobiles, digital cameras,
mp3 players and personal digital assistants, etc. The basic limitation of these devices is the other resources
and limitation of memory.
Small Scale Embedded Systems
These types of embedded systems are designed with a single 8 or 16-bit microcontroller, that may even be
activated by a battery. For developing embedded software for small scale embedded systems, the main
programming tools are an editor, assembler, cross assembler and integrated development environment (IDE).
Medium Scale Embedded Systems
These types of embedded systems design with a single or 16 or 32 bit microcontroller, RISCs or DSPs. These
types of embedded systems have both hardware and software complexities. For developing embedded
software for medium scale embedded systems, the main programming tools are C, C++, JAVA, Visual C++,
RTOS, debugger, source code engineering tool, simulator and IDE.
Sophisticated Embedded Systems
These types of embedded systems have enormous hardware and software complexities, that may need ASIPs,
IPs, PLAs, scalable or configurable processors. They are used for cutting-edge applications that need
hardware and software Co-design and components which have to assemble in the final system.
Applications of Embedded Systems:
Embedded systems are used in different applications like automobiles, telecommunications, smart cards,
missiles, satellites, computer networking and digital consumer electronics.
Mobile Embedded Systems
Mobile embedded systems are used in portable embedded devices like cell phones, mobiles, digital cameras,
mp3 players and personal digital assistants, etc.The basic limitation of these devices is the other resources
and limitation of memory.
Small Scale Embedded Systems
These types of embedded systems are designed with a single 8 or 16-bit microcontroller that may even be
activated by a battery. For developing embedded software for small scale embedded systems, the main
programming tools are an editor, assembler, cross assembler and integrated development environment (IDE).
Medium Scale Embedded Systems
These types of embedded systems design with a single or 16 or 32 bit microcontroller, RISCs or DSPs. These
types of embedded systems have both hardware and software complexities. For developing embedded
software for medium scale embedded systems, the main programming tools are C, C++, JAVA, Visual C++,
RTOS, debugger, source code engineering tool, simulator and IDE.
Sophisticated Embedded Systems
These types of embedded systems have enormous hardware and software complexities, that may need ASIPs,
IPs, PLAs, scalable or configurable processors. They are used for cutting-edge applications that need
hardware and software Co-design and components which have to assemble in the final system.
Applications of Embedded Systems:
Embedded systems are used in different applications like automobiles, telecommunications, smart cards,
missiles, satellites, computer networking and digital consumer electronics.
Advantages
 Easily Customizable
 Low power consumption
 Low cost
 Enhanced performance
Disadvantages
 High development effort
 Larger time to market

PROGRAMMABLE LOGIC CONTROLLERS


Industrial control circuits are designed to serve several functions:
i. Switching: It is necessary to switch on control elements to operate actuators like
hydraulic cylinders, electric motors, pneumatic valves etc. For example, a pneumatic or
hydraulic cylinder may be used to actuate the door closing function in a CNC machine.
ii. Sequencing: Certain functions in machines should be performed in a particular order.
For example, if two cylinders, shown in Fig. 11.2 are to be operated in sequence, the
sequence may be any one of the following:
A B B- A
A A- B B
A B B- A
B A A- B
B B- A A
B A B- A-
“- “ Symbol denotes the movement of the cylinder in the reverse direction.
For example, the sequence ABB-A- means:
• Cylinder A moves forward first
• Cylinder B moves forward next
• Cylinder A retracts and then
• Cylinder B retracts
iii. Process Control: A PLC may be used to control a process on the basis of signals
received from a process. The signals may be analog or digital. PLC is a microprocessor-
based unit that carries out control functions of many levels and complexity. PLC is used to
monitor process parameters in industries and adjust process control parameters on the
basis of a built-in logic. It is user-friendly and can be operated by even unskilled persons.

Typical PLC applications are listed below:


(a) Switching functions in a CNC machine tool like spindle motor on/off, coolant motor
on/off, chuck opening and closing, tailstock forward/reverse, door close/ open, guard
open/close, pallet change etc.
(b) Operation of lifts in buildings.
(c) Control of electric motors in industrial drives.
(d) Transfer machine control.
(e) Heating control in process industries.
(f) Control of traffic signals.
(g) Safety control of presses.
(h) Robot control.
(i) Home and medical equipment.
PLC is widely used because of several of its advantages, some of which are described in
the following sections:
(i) Flexibility: A PLC can be used for controlling one machine or a group of machines. A PLC
program can be altered easily through a keyboard sequence so that the machine functions
can be modified at the will of the designers without incurring additional cost of hardware
or scrapping existing hardware.
(ii) Low cost: Technological developments in microelectronics technology have reduced the
cost of PLC’s considerably.
(iii) Speed of operation: PLC’s operate faster than relays.
(iv) Security: A PLC program cannot be altered without unlocking the program.
(v) Reprogramming: In the case of transfer machines the modifications in the control
circuit can be carried out by simple reprogramming so that same hardware can
be used for a new sequence.
(vi) Modularity: PLC’s can be assembled in a modular fashion. The designer can add
modules depending upon his requirement of the number of inputs and outputs.
(vii) Analog and digital inputs: PLC can input/output both analog and digital signals.
(viii) Correction of errors: Efficient debugging procedure enables easy error correction.
(ix) Off-line programming: PLC program can be designed off-line and tested before
implementation.
(x) Boolean programming: PLC programming can be carried out using a ladder diagram by
an experienced technician.
(xi) Documentation: PLC programming devices can generate a printout as soon as the
ladder diagram is completed. This avoids the need for separate documentation efforts.
(xii) Reliability: Since PLC is a solid-state device the reliability is very high.
(xiii) Maintainability: The modular nature of the PLC design makes maintenance easy.
PARTS OF A TYPICAL PLC SYSTEM
Figure 11.3 shows the block diagram of a PLC system. It consists of four major parts, which
are briefly described below:

(i) The central processing unit (CPU): Like a computer this is the brain of a PLC.
It has several sub-parts.
(a) A microprocessor to carry out arithmetic and logic operations.
(b) Memory to store data and programs.
(c) Process image memory.
(d) Internal timers and counters.
(e) Flags.
(ii) Input module: This acts as an interface between the field inputs and the CPU. The
input module accepts voltage signals from the limit switches, sensors, transducers,
proximity switches, push buttons etc. The input signals can be analog or digital.
The input module performs four tasks.
• It senses the presence or absence of input signals at each of its input
terminals. The input signal tells what switch, sensor, or other signal is on
or off in the operation being controlled.
• It converts the input signal to a DC level useable by the PLC’s electronic circuit.
• The input module carries out electronic isolation of output from input.
• It produces an output sensed by CPU.
A typical input module will have 4, 6, 8, 12, 16, or 32 terminals.
(iii) Output module: The output module interfaces the output devices like contactors,
lamps, relays, solenoid valves etc. with the CPU. The output module acts in
just opposite manner to input module. A signal from CPU is received by the
output module, once for each scan. If the CPU signal code matches the assigned
number of the module the module is turned on. The output modules will have
4,6,8,12,16 or 32 terminals.
(iv) Power supply
(v) Racks and chassis to mount the elements
PROGRAMMING OF PLC
Entering and storing a sequence of instructions in the memory of the PLC either can be
carried out by a hand-held programming device or using a personal computer. The
programming can be done either on-line or off-line as desired by the programmer.
11.6.1 OFF-LINE PROGRAMMING
Off-line programming is used to design programs prior to running the machine. This
permits the programs to be checked prior to implementation and detect any bug in the
program.
This is the preferred method of programming.
ON-LINE PROGRAMMING
On-line programming is implemented with the direct connection to the PLC. Changes in the
program are made when the PLC is in the running mode.
11.6.3 LADDER LOGIC
The type programming used for PLC is ladder logic. This is a graphical representation of
the hard-wired system used in electrical circuits and includes switches, timers, counters,
and many other pieces of hardware in a structured manner. Figure 11.5 shows one rung of
a circuit diagram and the corresponding ladder diagram.

The left hand of the ladder diagram is the live supply and the right hand is the neutral or
common line. The flow of control is from left to right. The operation of the ladder logic can
be explained with the help of a simple example of starting an electric motor. Figure 11.6
shows a single rung motor starter circuit.
The activation of the motor will occur when all the input devices on the rung will provide
continuity from left to right to the output device. However, this cannot be used practically.
Another path to the motor is needed to keep the motor running. This is shown in Fig. 11.7.
When the start button is depressed the motor will start and the relay contact parallel to
the start button will close. When the start button is released current will flow through the
relay contact until the stop button is pressed. This will open the relay contact and stop the
motor. In terms of the Boolean logic the motor will run if: (Start depressed OR IR relay
closed) AND (STOP closed). Now this can be programmed in the PLC software using
contact symbols as shown in Fig. 11.7.

EXAMPLE OF APPLICATION OF PLC IN A CNC MACHINE


In CNC machines PLC is used for realizing several functions. In some machines PLC is
integral with the CNC system. In most of the machines PLC is separate. The PLC program is
designed by the manufacturer of the machine to satisfy the specification requirements of
the machine. The input/output of a PLC in a CNC lathe is given in Table 11.1.
The ladder diagram for the machine is shown in Fig. 11.8 (a) and (b). A careful
reading of the ladder diagram will reveal that the switching functions are effectively
managed by the PLC in a flexible manner.

You might also like