You are on page 1of 93

A system in which actions are controlled by direct insertion of numerical data at some point.

The system must automatically interpret at least some portion of this data.

Computer control
Servo axis control Tool changers Pallet changers On-machine programming Data communication Graphical interface

1947: J. Parsons (Parsons Corporation) began experimenting for using 3-axis curvature data to control machine tool motion for the production of aircraft components 1949: Parsons awarded a US Air Force contract to build the first NC machine Laboratory for Manufacturing Systems and Automation 1951: MIT was involved in the project 1952: NC achieved when MIT demonstrated that simultaneous 3-axis movements were possible using a laboratory-build controller and a Cincinnati HYDROTEL vertical spindle 1955: after refinements NC become available to industry


Early NC machines run off punched cards and tape Due to the time and effort for editing and changing tapes, computers were introduced for programming Computer Aided Programming Languages: Allow the development of an NC program using a set of universal English commands Computer translate commands into machine codes Machine codes are punched into the tapes Direct Numerical Control: A computer is used as a partial or complete controller of one or more NC machines


Numerical control (NC) was developed with these goals in mind: To increase production To reduce labor costs To make production more economical To do jobs that would be impossible or impractical without NC To increase the accuracy of duplicate parts

Increased productivity Reduced tool/fixture storage and cost Faster setup time Reduced parts inventory Flexibility that speeds changes in design Better accuracy of parts Reduction in parts handling Better uniformity of parts Better quality control Improvement in manufacturing control

Increase in electrical maintenance High initial investment Higher per-hour operating cost than traditional machine tools Retraining of existing personnel NC is a general term used for Numerical Control. CNC refers specifically to COMPUTER NUMERICAL CONTROL. CNC machines are all NC machines But all NC machines are not CNC machines


Conventionally, an operator decides and adjusts various machines parameters like feed , depth of cut etc depending on type of job , and controls the slide movements by hand. In a CNC Machine, functions and slide movements are controlled by motors using computer programs. CNC machine control unit (MCU) decides cutting speed, feed, depth of cut, tool selection , coolant on off and tool paths. The MCU issues commands in form of numeric data to motors that position slides and tool accordingly.

CNC Motion-Control Commands

Commands for motion Commands for individual components


NC classification regarding
Motion control: PTP versus continuous path Control loops: open versus close Power drives: hydraulic, electric, or pneumatic Positioning systems: incremental or absolute positioning Hard-wired NC and soft-wired CNC


Controls both the displacement and the velocity.

Machining profiles.
Precise control. Use linear and circular interpolators.

Motion control for NC

Inverse kinematics is to convert the position and orientation commands into the machines axes commands

Interpolation is to coordinate multiple axes to move the tool on a desired trajectory


Interpretation: Linear path

Interpolation is important when we try to control the path of the tool.



a. OPEN LOOP CONTROL SYSTEM Does not provide positioning feedback to the control unit. Counts tool movement pulses only Cannot identify discrepancies in positioning, slightly inaccurate. b . CLOSED LOOP SYSTEM

The electronic movement pulses are sent from the control to the servomotor, enabling the motor movement. Movements are detected by a feedback device (transducer), which can send a signal to the control for checking after each step.


Milling Machine Operations such as milling, contouring, gear cutting, drilling, boring, and reaming operations which can be performed on a milling machine. The milling machine can be programmed on three axes: The X axis controls the table movement left or right. The Y axis controls the table movement toward or away from the column. The Z axis controls the vertical (up or down) movement of the knee or spindle.

5-axis machine - 1


5-axis machine - 2


5-axis machine - 3


Rotary table attachment

(Courtesy of Fadal Machine)




AXIS REPRESENTATION All computer controlled machines are able to accurately and repeatedly control motion in various directions. Each of these directions of motion is called an axis. Depending on the machine type there are commonly two to five axes. Additionally, a CNC axis may be either a linear axis in which movement is in a straight line, or a rotary axis with motion following a circular path.

NC program functions
Preparatory functions Coordinates Machining parameters: feed and speed Tool control Cycle functions Coolant control Miscellaneous control Interpolators


Reference Points
Machine Reference Zero:
Each axis of motion has a reference point which provides a starting point for each axis
All positions are measured with respect to this point.

The reference points of all the axes determine a machines reference zero point.
All distances are measured with respect to this point.

Program Reference Zero:

Reference point for measuring distance on the part or drawing.

Local Reference Zero:

Temporary reference point from which distances can be measured.

Reference Points (contd)

(0,0,0) m/c home zero workpiece LRZ


program reference zero




Machine Zero - Machine zero is a point at the origin of the machines coordinate measuring system. All the Axis movements and other dimensions are measured from this point. It is similar to the origin of coordinate measuring system. Machine reference point - It refers to the initial point of return for the purpose of measuring/feedback systems. Whenever a CNC machine is switched on the feedback system has to be initialized by referring this point on every axis. Work Zero - This is the origin for the measuring of dimensions of work piece. The programmer is free to select it anywhere on the drawing. Absolute measuring system - In this measuring system all the dimensions are made from the work zero, which defined. The machine control uses work zero as the reference point to position the tool during program execution. The main advantage of programming in absolute system is that any point can be readily changed without affecting subsequent dimensions.

Incremental measuring system - The movements are based on the change

in position between two successive points. It expresses the relative distance between the current location and the next position. This type of measuring system is called Incremental Measuring system. The main advantage of this system is that sum of the dimensions must always be zero if start point and finishing point is same at the end of programming which makes it easy to check a program.

Axis designation (conventions) - Axis designation for each type of machine

tool is suggested in the EIA (Electronic Industries Association) RS 274-B standard. This conforms to ISO Recommendations R831. The nomenclature of the three main axes (X, Y AND Z) is based on the Left hand rule. The thumb indicates the orientation of the X-axis; the index finger indicates the Y-Axis, and the middle finger points in the direction of the Z-axis.

Tool and tool offset - The T function is used to call the particular tool and

tool offset in the program. The tool offset is used to correct the values entered in the coordinate system preset block. Using the tool offsets, it is easy to set up the tools and to make adjustments in part size.

Spindle speed - The spindle

is the rotational frequency of the spindle of the machine, measured in revolutions per minute (RPM). The preferred speed is determined based on the material being cut. Using the correct spindle speed for the material and tools will greatly affect tool life and the quality of the surface finish.

Feed rate - Feed rate is the velocity at which the cutter is fed, that is, advanced
against the work piece. It is expressed in units of distance per revolution for turning and boring (millimeters per revolution). For milling it is expressed in units of distance per time for milling (millimeters per minute).

Cutting Speed - Cutting speed may be defined as the rate (or speed) that the
material moves past the cutting edge of the tool , irrespective of the machining operation used the surface speed.

Accuracy Repeatability

Spindle and axis motor horsepower

Number of controlled axes

Dimension of workspace
Features of the machine and the controller.

Accuracy = control instrumentation resolution and hardware accuracy.

Control resolution: the minimum length distinguishable by the control unit (BLU). Hardware inaccuracies are caused by physical machine errors.


Hydrostatic Slide Way
Hydrostatics are an improvement over rolling element and plain slides because they are a non-contact bearing, resulting in zero starting friction, zero wear, error averaging for straight, smooth silent operation and the highest possible damping function.

Recirculating Ball Screw

A ball screw is a mechanical linear actuator that translates rotational motion to linear motion with little friction. A threaded shaft provides a spiral raceway for ball bearings which act as a precision screw. As well as being able to apply or withstand high thrust loads they can do so with minimum internal friction. They are made to close tolerances and are therefore suitable for use in situations in which high precision is necessary. The ball assembly acts as the nut while the threaded shaft is the screw. In a CNC machine, the connection between the screw and the nut is through an endless stream of re-circulating steel balls, replacing sliding friction threads with rolling friction. Advantages are higher efficiency, reversibility and reduction in wear and tear.

Control systems
There are two types of control systems on CNC machines: Open loop (less accurate) Closed loop (more accurate)

Drive motors

The drive motors control machine slide movement on CNC equipment. Types used : 1. Stepper motors (convert a digital pulse into a small rotation, mostly used in applications where low torque is required ) 2. DC servo motors (rotate in response to the applied voltage, used to drive lead screw and gear mechanisms, provide highertorque o/p 3. AC servo motors (controlled by varying the voltage frequency to control speed, more power than a DC servo, used to drive a lead screw and gear mechanism ) 4. Fluid servo motors (variable speed motors, produce more power, in the case of pneumatic motors, than electric servomotors)

Drives of CNC Machine Tool

Leadscrew and machine ways (Courtesy of Cincinnati



Tool changers Several different cutting tools are used to produce a part. The tools must be replaced quickly for the next machining operation. Majority of NC/CNC machine tools are equipped with automatic tool changers. They allow tool changing without the intervention of the operator.
Automatic Tool Changer

Grips the tool in the spindle, pulls it out, and replaces it with another tool. Tool changers are equipped for either random or sequential selection. IN RANDOM TOOL SELECTION THERE IS NO SPECIFIC PATTERN OF TOOL SELECTION. IN SEQUENTIAL TOOL SELECTION, THE TOOLS MUST BE LOADED IN THE EXACT ORDER IN WHICH THEY ARE CALLED FOR IN THE PROGRAM.

Turret Head Tool Changer

180 Degree Rotation Tool Changer

Pivot Insertion Tool Changer

The method by which contouring machine tools move from one programmed point to the next is called interpolation. This ability to merge individual axis points into a predefined tool path is built into most of todays MCUs. There are five methods of interpolation: Linear, Circular, Helical, Parabolic, And Cubic All contouring controls provide linear interpolation, and most controls are capable of both linear, circular , helical, parabolic, and cubic interpolation. These are used by industries that manufacture parts which have complex shapes, such as aerospace parts and dies for car bodies.



To program an arc , the MCU requires only the coordinate positions (the XY axes) of the circle center, the radius of the circle, the start point and end point of the arc being cut, and the direction in which the arc is to be cut (clockwise or counterclockwise)


Computer Numerical control machines are programmed by means of a series of coded instructions, commonly entered into the controller using manual programming. A typical block of instruction is of the following form: Block Format N135 G01 X1.0 Y1.0 Z0.125 F5 Sample Block Restrictions on CNC blocks Each may contain only one tool move Each may contain any number of non-tool move G-codes Each may contain only one feed rate Each may contain only one specified tool or spindle speed The block numbers should be sequential Both the program start flag and the program number must be independent of all other commands (on separate lines) The data within a block should follow the sequence shown in the above sample block


Name of the program Selection of Working plane, Measuring system ( Absolute or incremental ), Unit of measurement (mm or inch) Defining and calling work origin

Tool changing position (Remote area away from work piece), Tool call & Tool change
First position (Movement in working Plane) and Second positioning (Movement in spindle axis) for working, Spindle start & coolant on Third positioning for working (for mechanizing, tool movement with tool radius compensation) Depth of cut (in feed only) Definition of geometry/preparation of profile (feeding of CNC drawing data) Return to second position, spindle stop & coolant off Cancellation of fixed cycles, Macro instructions, Special commands, Tool Radius compensation Return to tool change position Movement in spindle axis and in working plane If required, repeat step Nos. to 16 as required.

End of part program

WARNINGS AND CAUTIONS RELATED TO PROGRAMMING Coordinate system setting Positioning by nonlinear interpolation Function involving a rotation axis Inch/metric conversion

Constant surface speed control

When an axis subject to constant surface speed control approaches the origin of the work-piece coordinate system, the spindle speed may become excessively high. Therefore, it is necessary to specify a maximum allowable speed.

Stroke check
Tool post interference check Absolute/incremental mode Plane selection Torque limit skip

Programmable mirror image

Compensation function

The most common codes used when programming CNC 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, while Group 09 deals with canned cycles. A G00 code rapidly positions the cutting tool while it is above the work piece 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

CODE TYPES Sequence Number (N-Codes)

This is an identification number for each block of instructions and increases sequentially through the program.

Preparatory Function (G-Codes)

The G-codes are the codes that position the tool and do the actual work These codes are largely standardized and can be seen in the provided G-code table. Many of the preparatory functions can indicate canned cycles. Co- ordinate Codes These indicate the co-ordinates for the tool movement. Four to five axis machines can have the following axes Cartesian Co-ordinates Angular positions for the Cartesian axes

Circular Interpolation about Cartesian axes


Feed rate (F-code) This specifies the feed rate for the operation. The units may be mm per minute or mm per revolution (indicated by the G-code used), with the decimal point implied at a fixed position from the right. Spindle speed (s-code) This specifies the spindle speed to be used for the operation. Tool Number This indicates to the controller which tool is to be used for the operation. In case of tool adaptors with multiple tool slots, the machine just switches to the next tool without removing the earlier one form the adaptor.


G CODE G00 G01 G02 G03 G04 G17 G18 G19 G20- 21 G28 G40 G41 G42 G43 G44 FUNCTION Positioning (Rapid traverse) Linear Interpolation (Cutting feed) Circular interpolation /Helical cutting CW Circular interpolation/Helical cutting CCW Dwell Time XY plane selection ZX plane selection YZ plane selection Input in inch and mm respectively. Return to reference point Cutter compensation cancel Cutter compensation left Cutter compensation right Tool length compensation + direction Tool length compensation direction

G53 G54 - 59 G71 G73 G76 G78 G81 G82 G83 G90 G91 G92 G94/98 G95/99 G96 G97 G98 G99

Machine coordinates system selection Work co-ordinate system 1 -6 selection Stock removal Canned Cycle Pattern Repeating Canned Cycle Thread Cutting Canned Cycle Grooving Cycle Canned Cycle Drilling cycle, spot boring Drilling cycle, counter boring Peck drilling cycle Absolute command Incremental command Programming of absolute zero point Feed per minute Feed per rotation Constant surface speed control Constant surface speed controls cancel Return to initial point in canned cycle Return to R point in canned cycle


CODE M00 M01 M02 M04 M05 M06 M07 M08 M09 M10 M11 M13 M14 M 20 29 M30 M31 M40-M45 M90 M99 FUNCTION Program stop, spindle and coolant off Optional programmable stop End of program-often interchangeable with M30 Spindle on CCW Spindle stop Tool change Coolant supply No. 1 on Coolant supply No. 2 on Coolant off Clamp Unclamp Spindle on, CW + Coolant on Spindle on, CCW + Coolant on Unassigned Program stops at end of tape+ tape rewind Interlock by-pass Gear Changes; otherwise unassigned Reserved for user (Subroutine call) Reserved for user

PREPARATORY FUNCTION (G CODE) G00-Rapid position G01-Linear interpolation G02-Circular interpolation (CW) G03-Circular interpolation(CCW) G20- Inch data input G21- Metric data input G28- Reference point return G40- Tool nose radius compensation cancel G50- Maximum spindle speed setting G70- Finishing cycle G71- stock removal in turning G72- stock removal in facing G74- peck drilling in z-axis G75- Multiple grooving cycle G76- Multiple thread cutting cycle G98- Feed per minute

MISCELLANEOUS FUNCTION (M CODE) M03- Spindle rotation (cw) M05- Spindle stop M06- Tool change M08- Coolant ON M09- Coolant OFF M70- X-axis mirror ON M71- Y-axis mirror ON M80-X-axis mirror OFF M81-Y-axis mirror OFF M98- Sub program call M99- Sub program exit

The G01, G02, and G03 codes move the axes at a controlled feed rate. G01 is used for straight-line movement (linear interpolation). G02 (clockwise) and G03 (counterclockwise) are used for arcs and circles (circular interpolation).



SYNTAX FOR TURNING CENTRE (LATHE ) FAST TRAVERSE-G00 G00 X Z G00 => Fast Traverse X , Z => Co-ordinate values LINEAR MOTION-G01 G01 X Z G01 => Linear motion X , Z => Co-ordinate values REFERENCE POINT-G28 G28 U0 W0 G28 => Reference point U , W => Machine Reference Point CIRCULAR INTERPOLATION-G02/G03 G02 X Z R F G03 X Z R F G02 => Clockwise circular interpolation G03 => Counter clockwise interpolation X , Z => Co-ordinate values R => Radius of the CW /CCW ARC

MULTIPLE TURNING-G71 G71 U R G71 P Q U W F G71 => Multiple Turning U => Depth of cut R => Relief amount P => Start block Q => End block U => Finishing allowance in the X axis W => Finishing allowance in the Z axis F => Feed /minute

PATTERN REPEATING G73 G73 U R G73P Q U W F G73 => Pattern Repeating U => Amt. of Matl. To be removed (Max. dia of w/p Min. dia of profile)/2 R => U/ Depth of cut P => Start block Q => End block U => Finishing allowance in the X axis W => Finishing allowance in the Z axis F => Feed /minute
FINISHING CYCLE-G70 G70 P Q F G70 => Finishing Cycle P => Start block Q => End block F => Feed /minute

FINISHING CYCLE-G70 G70 P Q F G70 => Finishing Cycle P => Start block Q => End block F => Feed /minute

GROOVING CYCLE-G75 G75 R G75 X Z P Q F G75 => Grooving Cycle R => Return amount X , Z => Co-ordinate values P => Peck increment in X-axis (microns) Q => Stepping distance in Z-axis (microns) F => Feed /minute MULTIPLE THREADING CYCLE-G76 G76 P(m)(r)(a) Q(q1) R G76 X Z P Q(q2) F m => Repetitive count in finishing r => Pull out angle a => Angle of tool tip q1 => Minimum cutting depth R => Finishing allowance X , Z => Co-ordinate values P => Height of the thread as a radius value x 1000 q2 => Depth of the first cut as a radius value x 1000 F => Lead or Pitch of the thread


Each line of program == 1 block Each block is composed of several instructions, or (words)

Sequence and format of words: N3 G2 X+1.4 Y+1.4 Z+1.4 I1.4 J1.4 K1.4 F3.2 S4 T4 M2

sequence no

destination coordinates

feed rate dist to center of circle spindle speed


preparatory function

miscellaneous function

The machine zero point can be set by three 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 G28 command in the program. Then another command (G92 for absolute zero shift) tells the MCU how far from the home zero location, the coordinate system origin is to be positioned as shown in the fig.







G33 X Z K Where, K = Pitch of the thread


G42(Radius compensation on the right side of the profile)

G41(Radius compensation on the left side of the profile)


U (i d) : depth of cut (radius designation) designation without sign) in x direction R (e ) : escaping amount/retraction P : sequence number of first block for Programming of finishing shape Q : sequence number of last block for programming of finishing shape U (i u) : distance and direction of finishing allowance in X direction (dia /radius) W (i w): distance and direction of finishing allowance in Z direction


G73 U(i I) W(i k) R(d) G73 P(-) Q(-) U(i u) W(i w) F(f) S(s) T(t) ; U(i I) = Maximum Dia of the Work piece-Minimum diameter of the profile /2 W(i k) = Escape Distance and direction in Z axis R( d) = U(i I) / Depth of cut = No. of times the cycle is to be repeated



G75(X direction grooving : Peck drill cycle in turning)

G75 R(e) : G75 X(u) Z(w) P( i) Q( k) R( d) F :

G76 P (m r a) Q (D) R (d)


There is also a provision for an Rword for taper threads.

G76 X (Root Diameter) Z ( Distance of thread) P (Depth) Q (First Depth) F (Feed) The threading cycle in this program is based

on the following parameters:

m= Number of finishing passes = 3, r = Chamfer distance = 1.5 3.5 = 5.25 mm (3.5 mm is pitch)

a= Thread angle (tool-tip angle) = 60 degree,

Q= Minimum depth of cut or Finishing allowance = 150 micron = 0.15 mm X= Core diameter = 25.706 mm

Z= Axial end of thread = 30 mm in the

negative Zdirection P= Depth of thread = 2147 micron = 2.147 mm Q= First depth of cut = 250 micron = 0.25 mm,

F= Lead (= pitch, for single-start) = 3.5 mm