Introduction to Cnc Programming and Industrial Robotics

  • Upload
    taridan

  • View
    235

  • Download
    0

Embed Size (px)

Citation preview

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    1/50

    1

    INTRODUCTION TO COMPUTER NUMERICAL CONTROL

    The variety being demanded in view of the varying tastes of the consumer calls for a very

    small batch sizes. Small batch sizes will not be able to take advantage of the mass

    production techniques such as special purpose machines or transfer lines. Hence, the need

    for flexible automation is felt , where you not only get the benefits of rigid automation but

    are also able to vary the products manufactured thus bringing in the flexibility. Numerical

    control fits the bill perfectly and we would see that manufacturing would increasingly be

    dependent on numerical control in future.

    Numerical control

    Numerical control of machine tools may be defined as a method of automation in which

    various functions of machine tools are controlled by letters, numbers and symbols. Basically a

    NC machine runs on a program fed to it. The program consists of precise instructions about

    the methodology of manufacture as well as movements.

    For example, what tool is to be used, at what speed, at what feed and to move from which

    point to which point in what path. Since the program is the controlling point for product

    manufacture, the machine becomes versatile and can be used for any part. All the functions of

    a NC machine tool are therefore controlled electronically, hydraulically or pneumatically.

    In NC machine tools, one or more of the following functions may be automatic.

    a. Starting and stopping of machine tool spindle.

    b. Controlling the spindle speed.

    c. Positioning the tool tip at desired locations and guiding it along desired paths by automatic

    control of motion of slides.

    d. Controlling the rate of movement of tool tip (feed rate)

    e. Changing of tools in the spindle.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    2/50

    2

    Functions of a machine tool

    The purpose of a machine tool is to cut away surplus material, usually metal from the material

    supplied to leave a work piece of the required shape and size, produced to an acceptable

    degree of accuracy and surface finish. The machine tool should possess certain capabilities in

    order to fulfill these requirements. It must be

    a. Able to hold the work piece and cutting tool securely.

    b. Endowed the sufficient power to enable the tool to cut the work piece material at

    economical rates.

    c. Capable of displacing the tool and work piece relative to one another to produce the

    required work piece shape. The displacements must be controlled with a degree of precision

    which will ensure the desired accuracy of surface finish and size.

    Concept of numerical control

    Formerly, the machine tool operator guided a cutting tool around a work piece by

    manipulating hand wheels and dials to get a finished or somewhat finished part. In his

    procedure many judgments of speeds, feeds, mathematics and sometimes even tool

    configuration were his responsibility.

    The number of judgments the machinist had to make usually depended on the type of stock he

    worked in and the kind of organization that prevailed. If his judgment was an error, it resulted

    in rejects or at best parts to be reworked or repaired in some fashion.

    Decisions concerning the efficient and correct use of the machine tool then depended on the

    craftsmanship, knowledge and skill of the machinist himself. It is rare that two expert

    operators produced identical parts using identical procedure and identical judgment of speeds,

    feeds and tooling. In fact even one craftsman may not proceed in same manner the second

    time around.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    3/50

    3

    Process planners and programmers have now the responsibilities for these matters. It must be

    understood that NC does not alter the capabilities of the machine tool. With NC the correct

    and most efficient use of a machine no longer rests with the operator. Actual machine tool

    with a capable operator can do nothing more than it was capable of doing before a MCU was

    joined to it. New metal removing principles are not involved. Cutting speeds, feeds and

    tooling principles must still be adhered to. The advantage is idle time is reduced and the

    actual utilization rate is much higher (compresses into one or two years that a conventional

    machine receives in ten years).

    Historical Development

    1947 was the year in which Numerical control was born. It began because of an urgent need.

    John C Parsons of the parsons corporation, Michigan, a manufacturer of helicopter rotor

    blades could not make his templates fast enough. So, he invented a way of coupling computer

    equipment with a jig borer.

    The US air force realized in 1949 that parts for its planes and missiles were becoming more

    complex. Also the designs were constantly being improved; changes in drawings were

    frequently made. Thus in their search for methods of speeding up production, an air force

    study contract was awarded to the Parsons Corporation. The servomechanisms lab of MIT

    was the subcontractor.

    In 1951, the MIT took over the complete job and in 1952; a prototype of NC machine was

    successfully demonstrated. The term Numerical Control was coined at MIT. In 1955 seven

    companies had tape controlled machines. In 1960, there were 100 NC machines at the

    machine tool shown in Chicago and a majority of them were relatively simple point to point

    application.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    4/50

    4

    During these years the electronics industry was busy. First miniature electronic tubes were

    developed, then solid state circuitry and then modular or integrated circuits. Thus the

    reliability of the controls has been greatly increased and they have become most compact and

    less expensive.

    Today there are several hundred sizes and varieties of machines, many options and many

    varieties of control system available.

    Definition:

    The simplest definition is as the name implies, a process a controlled by numbers .

    Numerical Control is a system in which the direct insertions of programmed numerical value,

    stored on some form of input medium are automatically read and decoded to cause a

    corresponding function on the machine tool which it is controlling.

    Advantages of NC machine tools:

    1. Reduced lead time:

    Lead time includes the time needed for planning, design and manufacture of jigs, etc. This

    time may amount to several months. Since the need for special jigs and fixtures is often

    entirely eliminated, the whole time needed for their design and manufacture is saved.

    2. Elimination of operator errors:

    The machine is controlled by instructions registered on the tape provided the tape is correct

    and machine and tool operate correctly, no errors will occur in the job. Fatigue, boredom, or

    inattention by operator will not affect the quality or duration of the machining. Responsibility

    is transferred from the operator to the tape, machine settings are achieved without the

    operator reading the dial.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    5/50

    5

    3. Operator activity:

    The operator is relieved of tasks performed by the machine and is free to attend to matters for

    which his skills and ability are essential. Presetting of tools, setting of components and

    preparation and planning of future jobs fall into this category.

    It is possible for two work stations to be prepared on a single machine table, even with small

    batches. Two setting positions are used, and the operator can be setting one station while

    machining takes place at the other.

    4. Lower labor cost

    More time is actually spent on cutting the metal. Machine manipulation time for example,

    gear changing and often setting time are less with NC machines and help reduce the labor cost

    per job considerably.

    5. Smaller batches

    By the use of preset tooling and presetting techniques downtime between batches is kept at a

    minimum. Large storage facilities for work in progress are not required.

    Machining centers eliminate some of the setups needed for a succession of operation on one

    job; time spent in waiting until each of a succession of machine is free is also cut. The

    components circulate round the machine shop in a shorter period, inter department costs are

    saved and program chasing is reduced.

    6. Longer tool life

    Tools can be used at optimum speeds and feeds because these functions are controlled by the

    program.

    7. Elimination of special jigs and fixtures

    Because standard locating fixtures are often sufficient of work on machines, the cost of

    special jigs and fixture is frequently eliminated. The capital cost of storage facilities is greatly

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    6/50

    6

    reduced. The storage of a tape in a simple matter, it may be kept for many years and

    manufacturing of spare parts, repeat orders or replacements is made much more convenient.

    8. Flexibility in changes of component design

    The modification of component design can be readily accommodated by reprogramming and

    altering the tape. Savings are affected in time and cost.

    9. Reduced inspection

    The time spent on inspection and in waiting for inspection to begin is greatly reduced.

    Normally it is necessary to inspect the first component only once the tape is proved; the

    repetitive accuracy of the machine maintains a consistent product.

    10. Reduced scrap

    Operator error is eliminated and a proven tape results in accurate component.

    11. Accurate costing and scheduling

    The time taken in machining is predictable, consistent and results in a greater accuracy in

    estimating and more consistency in costing.

    Evolution of CNC

    With the availability of microprocessors in mid 70s the controller technology has made a

    tremendous progress. The new control systems are termed as computer numerical control

    (CNC) which are characterized by the availability of a dedicated computer and enhanced

    memory in the controller. These may also be termed soft wired numerical control.

    There are many advantages which are derived from the use of CNC as compared to NC.

    - Part program storage memory.- Part program editing.- Part program downloading and uploading.- Part program simulation using tool path.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    7/50

    7

    - Tool offset data and tool life management.- Additional part programming facilities.- Macros and subroutines.- Background tape preparation, etc.

    The controls with the machine tools these days are all CNC and the old NC control do not

    exist anymore.

    DEFINITION AND FEATURES OF CNC

    Computer Numerical Control (CNC)

    CNC refers to a computer that is joined to the NC machine to make the machine versatile.

    Information can be stored in a memory bank. The programme is read from a storage medium

    such as the punched tape and retrieved to the memory of the CNC computer.

    Some CNC machines have a magnetic medium (tape or disk) for storing programs. This gives

    more flexibility for editing or saving CNC programs. Figure 1 illustrates the general

    configuration of CNC.

    Figure 1: The general configuration of CNC

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    8/50

    8

    Advantages of CNC

    1. Increased productivity.

    2. High accuracy and repeatability.

    3. Reduced production costs.

    4. Reduced indirect operating costs.

    5. Facilitation of complex machining operations.

    6. Greater flexibility.

    7. Improved production planning and control.

    8. Lower operator skill requirement.

    9. Facilitation of flexible automation.

    Limitations of CNC

    1. High initial investment.

    2. High maintenance requirement.

    3. Not cost-effective for low production cost.

    Features of CNC

    Computer NC systems include additional features beyond what is feasible with conventional

    hard-wired NC. These features, many of which are standard on most CNC Machine Control

    units (MCU), include the following:

    - Storage of more than one part program: With improvements in computer storagetechnology, newer CNC controllers have sufficient capacity to store multiple

    programs. Controller manufacturers generally offer one or more memory expansions as

    options to the MCU.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    9/50

    9

    - Various forms of program input : Whereas conventional (hard-wired) MCUs arelimited to punched tape as the input medium for entering part programs, CNC

    controllers generally possess multiple data entry capabilities, such as punched tape,

    magnetic tape, floppy diskettes, RS-232 communications with external computers, and

    manual data input (operator entry of program).

    - Program editing at the machine tool: CNC permits a part program to be edited whileit resides in the MCU computer memory. Hence, a part program can be tested and

    corrected entirely at the machine site, rather than being returned to the programming

    office for corrections. In addition to part program corrections, editing also permits

    cutting conditions in the machining cycle to be optimized. After the program has been

    corrected and optimized, the revised version can be stored on punched tape or other

    media for future use.

    - Fixed cycles and programming subroutines: The increased memory capacity and theability to program the control computer provide the opportunity to store frequently

    used machining cycles as macros that can be called by the part program. Instead of

    writing the full instructions for the particular cycle into every program, a programmer

    includes a call statement in the part program to indicate that the macro cycle should be

    executed. These cycles often require that certain parameters be defined, for example, a

    bolt hole circle, in which the diameter of the bolt circle, the spacing of the bolt holes,

    and other parameters must be specified.

    - Interpolation: Some of the interpolation schemes are normally executed only on aCNC system because of computational requirements. Linear and circular interpolations

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    10/50

    10

    are sometimes hard-wired into the control unit, but helical, parabolic, and cubic

    interpolations are usually executed by a stored program algorithm.

    - Positioning features for setup: Setting up the machine tool for a given workpartinvolves installing and aligning a fixture on the machine tool table. This must be

    accomplished so that the machine axes are established with respect to the workpart.

    The alignment task can be facilitated using certain features made possible by software

    options in the CNC system. Position set is one of the features. With position set, the

    operator is not required to locate the fixture on the machine table with extreme

    accuracy. Instead, the machine tool axes are referenced to the location of the fixture

    using a target point or set of target points on the work or fixture.

    - Cutter length and size compensation: In older style controls, cutter dimensions hadto be set precisely to agree with the tool path defined in the part program. Alternative

    methods for ensuring accurate tool path definition have been incorporated into the

    CNC controls. On method involves manually entering the actual tool dimensions into

    the MCU. These actual dimensions may differ from those originally programmed.

    Compensations are then automatically made in the computed tool path. Another

    method involves use of a tool length sensor built into the machine. In this technique,

    the cutter is mounted in the spindle and the sensor measures its length. This measured

    value is then used to correct the programmed tool path.

    - Acceleration and deceleration calculations: This feature is applicable when thecutter moves at high feed rates. It is designed to avoid tool marks on the work surface

    that would be generated due to machine tool dynamics when the cutter path changes

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    11/50

    11

    abruptly. Instead, the feed rate is smoothly decelerated in anticipation of a tool path

    change and then accelerated back up to the programmed feed rate after the direction

    change.

    - Communications interface: With the trend toward interfacing and networking inplants today, most modern CNC controllers are equipped with a standard RS-232 or

    other communications interface to link the machine to other computers and computer

    driven devices. This is useful for various applications, such as (1) downloading part

    programs from a central data file; (2) collecting operational data such as workpiece

    counts, cycle times, and machine utilization; and (3)interfacing with peripheral

    equipment, such as robots that unload and load parts.

    - Diagnostics: Many modern CNC systems possess a diagnostics capability thatmonitors certain aspects of the machine tool to detect malfunctions or signs of

    impending malfunctions or to diagnose system breakdowns.

    The Machine Control Unit (MCU) for CNC

    The MCU is the hardware that distinguishes CNC from conventional NC. The general

    configuration of the MCU in a CNC system is illustrated in Figure 2. The MCU consists of

    the following components and subsystems: (1) Central Processing Unit, (2) Memory, (3)

    Input/Output Interface, (4) Controls for Machine Tool Axes and Spindle Speed, and (5)

    Sequence Controls for Other Machine Tool Functions. These subsystems are interconnected

    by means of a system bus, which communicates data and signals among the components of a

    network.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    12/50

    12

    - Central Processing Unit: The central processing unit (CPU) is the brain of the MCU.It manages the other components in the MCU based on software contained in main

    memory. The CPU can be divided into three sections: (1) control section, (2)

    arithmetic-logic unit, and (3) immediate access memory.

    The control section retrieves commands and data from memory and generates signals

    to activate other components in the MCU. In short, it sequences, coordinates, and

    regulates all the activities of the MCU computer. The arithmetic-logic unit (ALU)

    consists of the circuitry to perform various calculations (addition, subtraction, and

    multiplication), counting, and logical functions required by software residing in

    memory. The immediate access memory provides a temporary storage of data being

    processed by the CPU. It is connected to main memory of the system data bus.

    - Memory: The immediate access memory in the CPU is not intended for storing CNCsoftware. A much greater storage capacity is required for the various programs and

    data needed to operate the CNC system. As with most other computer systems, CNC

    memory can be divided into two categories: (1) primary memory, and (2) secondary

    memory. Main memory (also known as primary storage) consists of ROM (read-only

    memory) and RAMS (random access memory) devices. Operating system software

    and machine interface programs are generally stored in ROM. These programs are

    usually installed by the manufacturer of the MCU. Numerical control part programs

    are stored in RAM devices. Current programs in RAM can be erased and replaced by

    new programs as jobs are changed.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    13/50

    13

    Figure 2: Configuration of CNC machine control unit

    High-capacity secondary memory (also called auxiliary storage or secondary storage) devices

    are used to store large programs and data files, which are transferred to main memory as

    needed. Common among the secondary memory devices are hard disks and portable devices

    that have replaced most of the punched paper tape traditionally used to store part programs.

    Hard disks are high-capacity storage devices that are permanently installed in the CNC

    machine control unit. CNC secondary memory is used to store part programs, macros, and

    other software.

    - Input/output Interface: The I/O interface provides communication software betweenthe various components of the CNC system, other computer systems, and the machine

    operator. As its name suggests, The I/O interface transmits and receives data and

    signals to and from external devices, several of which are illustrated in Figure 2. The

    operator control panel is the basic interface by which the machine operator

    communicates to the CNC system. This is used to enter commands related to part

    program editing, MCU operating mode (e.g., program control vs. manual control),

    speeds and feeds, cutting fluid pump on/off, and similar functions. Either an

    alphanumeric keypad or keyboard is usually included in the operator control panel.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    14/50

    14

    The I/O interface also includes a display (CRT or LED) for communication of data and

    information from the MCU to the machine operator. The display is used to indicate

    current status of the program as it is being executed and to warn the operator of any

    malfunctions in the CNC system.

    Also included in the I/O interface are one or more means of entering the part program

    into storage. As indicated previously, NC part programs are stored in a variety of

    ways. Programs can also be entered manually by the machine operator or stored at a

    central computer site and transmitted via local area network (LAN) to the CNC

    system. Whichever means is employed by the plant, a suitable device must be included

    in the I/O interface to allow input of the program into MCU memory.

    - Controls for Machine Tool Axes and Spindle Speed: These are hardwarecomponents that control the position and velocity (feed rate) of each machine axis as

    well as the rotational speed of the machine tool spindle. The control signals generated

    by MCU must be converted to a form and power level suited to the particular position

    control systems used to drive the machine axes. Positioning systems can be classified

    as open loop or closed loop, and different hardware components are required in each

    case. Depending on the type of machine tool, the spindle is used to drive either (1)

    workpiece or (2) a rotating cutter. Turning exemplifies the first case, whereas milling

    and drilling exemplify the second. Spindle speed is a programmed parameter for most

    CNC machine tools. Spindle speed components in the MCU usually consist of s drive

    control circuit and a feedback sensor interface. The particular hardware components

    depend on the type of spindle drive.

    - Sequence Controls for Other Machine Tool Functions: In addition to control oftable position, feed rate, and spindle speed, several additional functions are

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    15/50

    15

    accomplished under part program control. These auxiliary functions are generally

    on/off (binary) actuations, interlocks, and discrete numerical data. To avoid

    overloading the CPU, a programmable logic controller is sometimes used to manage

    the I/O interface for these auxiliary functions.

    Classification Of CNC Machine Tools

    (1) Based on the motion type 'Point-to-point & Contouring systems

    There are two main types of machine tools and the control systems required for use with them

    differ because of the basic differences in the functions of the machines to be controlled. They

    are known as point-to-point and contouring controls.

    (1.1)Point-to-point systems

    Some machine tools for example drilling, boring and tapping machines etc, require the cutter

    and the work piece to be placed at a certain fixed relative positions at which they must remain

    while the cutter does its work. These machines are known as point-to-point machines as

    shown in figure 3 (a) and the control equipment for use with them are known as point-to-

    point control equipment. Feed rates need not to be programmed. In these machine tools, each

    axis is driven separately. In a point-to-point control system, the dimensional information that

    must be given to the machine tool will be a series of required position of the two slides. Servo

    systems can be used to move the slides and no attempt is made to move the slide until the

    cutter has been retracted back.

    (1.2) Contouring systems (Continuous path systems)

    Other type of machine tools involves motion of work piece with respect to the cutter while

    cutting operation is taking place. These machine tools include milling, routing machines etc.

    and are known as contouring machines as shown in figure 3 (b), 3 (c) and the controls

    required for their control are known as contouring control. Contouring machines can also be

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    16/50

    16

    used as point-to-point machines, but it will be uneconomical to use them unless the work

    piece also requires having a contouring operation to be performed on it. These machines

    require simultaneous control of axes. In contouring machines, relative positions of the work

    piece and the tool should be continuously controlled. The control system must be able to

    accept information regarding velocities and positions of the machines slides. Feed rates

    should be programmed.

    Figure 3 (a): Point-to-point system

    Figure 3 (b): Contouring system

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    17/50

    17

    Figure 3 (c): Contouring systems

    (2) Based on the control loops Open loop & Closed loop systems

    (2.1) Open loop systems (Fig 4(a)):

    Programmed instructions are fed into the controller through an input device. These

    instructions are then converted to electrical pulses (signals) by the controller and sent to the

    servo amplifier to energize the servo motors. The primary drawback of the open-loop system

    is that there is no feedback system to check whether the program position and velocity has

    been achieved. If the system performance is affected by load, temperature, humidity, or

    lubrication then the actual output could deviate from the desired output. For these reasons the

    open -loop system is generally used in point-to-point systems where the accuracy

    requirements are not critical. Very few continuous-path systems utilize open-loop control.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    18/50

    18

    Figure 4(a): Open loop control system Figure 4(b): Closed loop control system

    (2.2) Closed loop systems (Fig 4(b)):

    The closed-loop system has a feedback subsystem to monitor the actual output and correct

    any discrepancy from the programmed input. These systems use position and velocity

    feedback. The feedback system could be either analog or digital. The analog systems measure

    the variation of physical variables such as position and velocity in terms of voltage levels.

    Digital systems monitor output variations by means of electrical pulses. To control the

    dynamic behavior and the final position of the machine slides, a variety of position

    transducers are employed. Majority of CNC systems operate on servo mechanism, a closed

    loop principle. If a discrepancy is revealed between where the machine element should be and

    where it actually is, the sensing device signals the driving unit to make an adjustment,

    bringing the movable component to the required location.

    Closed-loop systems are very powerful and accurate because they are capable of monitoring

    operating conditions through feedback subsystems and automatically compensating for any

    variations in real-time.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    19/50

    19

    Figure 4 (c): Closed loop system

    (3) Based on the number of axes 2, 3, 4 & 5 axes CNC machines

    (3.1) 2& 3 axes CNC machines:

    CNC lathes will be coming under 2 axes machines. There will be two axes along which takes

    place. The saddle will be moving longitudinally on the bed (Z-axis) and the cross slide moves

    transversely on the saddle (along X-axis). In 3-axes machines, there will be one more axis,

    perpendicular to the above two axes. By the simultaneous control of all the 3 axes, complex

    surfaces can be machined.

    (3.2) 4 & 5 axes CNC machines (Fig. 5):

    4 and 5 axes CNC machines provide multi-axis machining capabilities beyond the standard 3-

    axis CNC tool path movements. A 5-axis milling centre includes the three X, Y, Z axes, the A

    axis which is rotary tilting of the spindle and the B-axis, which can be a rotary index table.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    20/50

    20

    Figure 5: Five axes CNC machine

    Importance of higher axes machining:

    Reduced cycle time by machining complex components using a single setup. In addition to

    time savings, improved accuracy can also be achieved as positioning errors between setups

    are eliminated.

    - Improved surface finish and tool life by tilting the tool to maintain optimum tool topart contact all the times.

    - Improved access to under cuts and deep pockets. By tilting the tool, the tool can bemade normal to the work surface and the errors may be reduced as the major of cutting

    force will be along the tool axis.

    - Higher axes machining has been widely used for machining sculptures surfaces inaerospace and automobile industry.

    (4) Based on the power supply Electric, Hydraulic & Pneumatic systems

    Mechanical power unit refers to a device which transforms some form of energy to

    mechanical power which may be used for driving slides, saddles or gantries forming a part of

    machine tool. The input power may be of electrical, hydraulic or pneumatic.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    21/50

    21

    Electric systems:

    Electric motors may be used for controlling both positioning and contouring machines. They

    may be either a.c. or d.c. motor and the torque and direction of rotation need to be controlled.

    The speed of a d.c. motor can be controlled by varying either the field or the armature supply.

    The clutch-controlled motor can either be an a.c. or d.c. motor. They are generally used for

    small machine tools because of heat losses in the clutches. Split field motors are the simplest

    form of motors and can be controlled in a manner according to the machine tool. These are

    small and generally run at high maximum speeds and so require reduction gears of high ratio.

    Separately excited motors are used with control systems for driving the slides of large

    machine tools.

    Hydraulic systems:

    These hydraulic systems may be used with positioning and contouring machine tools of all

    sizes. These systems may be either in the form of rams or motors. Hydraulic motors are

    smaller than electric motors of equivalent power. There are several types of hydraulic motors.

    The advantage of using hydraulic motors is that they can be very small and have considerable

    torque. This means that they may be incorporated in servo systems which require having a

    rapid response.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    22/50

    22

    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 section.

    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. (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, YandZdirections of

    the entire tool path to finish the component. The program should also contain information,

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    23/50

    23

    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),

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    24/50

    24

    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.

    (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.

    Figure 4.16 : Interactive Graphic System in Computer Aided Part Programming

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    25/50

    25

    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:

    Type of Dimensioning System

    We determine what type of dimensioning system the machine uses, whether an absolute or

    incremental dimensional system.

    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.

    NC WordsThe 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

    rising from 0 to 999.

    Figure 7: A Block of Information

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    26/50

    26

    Using the example shown in Figure 7. The words are as follows:

    N001represents the sequence number of the operation.

    G01represents linear interpolation.

    X12345will move the table in a positive direction along theX-axis.

    Y06789will move the table along the Y-axis.

    M03Spindle 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 Tare 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/orZ-

    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 work piece from one point to another point on a job. During the rapid

    traverse movement, either theXorY-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.

    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

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    27/50

    27

    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

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    28/50

    28

    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 functions:

    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

    M13 Tailstock spindle in

    M17 Tool post rotation normal

    M18 Tool post rotations 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.

    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:

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    29/50

    29

    N20 G00 X1.200 Y.100 F325 S1000 T03 M09

    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 shown 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

    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 theXand Ycoordinate 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

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    30/50

    30

    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.

    Figure 8: Machine Tool Zero Point Setting

    R = Reference point (maximum travel of machine)

    W= Part zero point workpeice 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).

    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.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    31/50

    31

    Example

    X150 Y-250 represents the movement to (150, - 250). Whether the dimensions are absolute or

    incremental will have to be defined previously using G-Codes.

    Parameter for Circular Interpolation

    These parameters specify the distance measured from the start point of the arc to the center.

    Numerals followingI,JandKare theX, YandZcomponents of the distance respectively.

    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:

    Example S 1000 represents a spindle speed of 1000 rpm Chuckclaming

    Feed Function

    The feed is programmed under anFaddress 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:

    Example

    F100 represents a feed rate of 100 mm/min.

    Tool Function

    The selection of tool is commanded under a Taddress. T04 represents tool number 4.

    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

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    32/50

    32

    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-Yaxes. 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 theZ-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.

    Figure 9: Work Settings

    Figure 10: Offsets

    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.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    33/50

    33

    Figure 11: Rapid Positioning

    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 theFaddress.

    Figure 12: Linear Interpolation

    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 byI,JandKaddresses. I is the distance along theX-axis,Jalong the Y,

    andKalong theZ. This parameter is defined as the vector from the starting point to the center of

    the arc.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    34/50

    34

    Figure 13: Clockwise Circular Interpolation

    Figure 14: Counter Clockwise Circular Interpolation

    Circular Interpolation

    In NC machining, if the cutter axis is moving along the programmed path, the dimension of theworkpiece 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.

    Figure 15: Tool Path without Cutter Compensation

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    35/50

    35

    Figure 16: Tool Path with Cutter Compensation

    SYMBOLS USED

    % Main Programme (1 to 9999)

    L Sub program (1 to 999)/Home position

    N Sequence of block number.

    Lf Block end (EOB) means ; or *

    T Tool number or Tool station number

    D Tool offset

    S Spindle speed

    F Feed

    M Switching function

    G Transverse commands

    R Parameters

    I, J, K Circle parameters

    B/U/R Radius

    X/Y/Z Axis coordinates

    P Passes.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    36/50

    36

    PART PROGRAM FOR LATHE OPERATION

    The CNC lathe operation such as simple facing, turning, taper turning, thread, boring, parting off

    etc. TheX-axis andZ-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).

    Figure 17: Turning Operation

    % 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)

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    37/50

    37

    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)

    Figure 18: Taper Turning

    % 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 X5Z30; (Taper turning operation)

    N30 G00 X1 Z66; (Final position of tool)

    M02; (End of programme)

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    38/50

    38

    Example 3 (All dimensions are in mm)

    Figure 19: Circular Interpolation

    % 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)

    PART PROGRAM FOR MACHINING CENTRES(MILLING)

    The CNC milling machine, the motion is possible in three axes, X-axis, Y-axis and Z-axis. The

    movement ofZ-axis is taken as positive when tool moves away from the job or vice versa.

    Example 1 (All dimensions are in mm).

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    39/50

    39

    Figure 20: Straight Line

    % 100; (Main programme)

    N5 G17 G71 G90 G94 G54; (Parameters Setting)

    N10 T2 L90; (Home position)

    N15 G00 D2 Z50 M3 S700 X10 Y-25; (Position of tool)

    N20 G01 Z-1.5; (Position of cut)

    N25 G01 X4 F100 M8; (Cutting slat)

    N30 G00 Z100 M9; (Final position of tool)

    N35 M30; (Main programme end)

    Example 02 (All dimensions are in mm).

    Figure 21: Circular Interpolation

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    40/50

    40

    %101; (Main programme)

    N2 G17 G71 G90 G94 G54; (Parameters Setting)

    N4 T1 L90; (Home position)

    N6 G00 Z5 D5 M3 S500 X20 Y90; (Position of tool)

    N8 G01 Z-2 F50; (Position of cut)

    N10 G02 X60 Y50 I0 J-40; (Circular interpolation clockwise-CW)

    N12 G03 X80 Y50 I20 J0; (Circular interpolation clockwise-CCW)

    N14 G00 Z100; (Final position of tool)

    N16 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

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    41/50

    41

    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).

    R00Dwell time at the starting point for chip removal.

    R02Reference plane absolute with sign.

    R03Final depth of hole absolute with sign.

    R04Dwell time at the bottom of drilled hole for chip breaking.

    R10Retract plane without sign.

    R11Drilling axis number 1 to 3.

    % 400;

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    42/50

    42

    Figure 22: Drilling Cycle

    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;

    Example 2 (G83 Deep Drilling Cycle) (All dimensions are in mm).

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    43/50

    43

    Figure 23: Deep Drilling Cycle

    R00Dwell time at the starting point for chip removal.

    R01First drilling depth (incremental) without sign.

    R02Reference plane absolute with sign.

    R03Final depth of hole absolute with sign.

    R04Dwell time at the bottom of drilled hole for chip breaking.

    R05Amount of digression is without sign.

    R10Retract plane without sign.

    R11Drilling axis number 1 to 3.

    % 401;

    N5 G17 G71 G90 G94 G55;

    N10 T1 L90;

    N15 G00 D5 Z5 M3 S600 X62 Y62;

    N20 G83 R00=30, R01=15, R02=5, R03=-60, R04=1,

    R05=15, R10=80, R11=3, F50 M7;

    N25 G00 G80 Z100 M9;

    N30 M02;

    Example 3 (G84 Tapping Cycle) (All dimensions are in mm).

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    44/50

    44

    Figure 23: Tapping Cycle

    R02Reference plane absolute with sign.

    R03Final depth of hole absolute with sign.

    R04Dwell time at the bottom of drilled hole for chip breaking.

    R06Reverse direction of spindle rotation.

    R07Return to the original direction of spindle rotation.

    R08Machine data setting.

    R09Thread pitch.

    R11Drilling axis number 1 to 3.

    % 403

    N5 G17 G71 G90 G94 G55; N10 T1 L90;

    N15 G00 D5 Z5 M3 S600 X27 Y27;

    N20 G81 R02=5, R03=-32, R11=3, F50 M7; N25 X97;

    N30 Y97; N35 X27;

    N40 G00 G80 Z100 M9; N45 T2 L90;

    N43 G00 D10 Z5 M3 S60 X27 Y27;N50 G84 R02=5, R03=-29, R04=1, R06=4, R07=3, R08=0, R09=1,

    R11=3

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    45/50

    45

    F60 M7;

    N55 X97;

    N60 Y97;

    N65 X27;

    N70 G00 G80 Z100 M9;

    N75 M02;

    Example 4 (G86 Boring cycle) (All dimensions are in mm).

    Figure 24: Boring Cycle

    R02Reference plane. R03Final depth of hole.

    R04Dwell time at the bottom of drilled hole for chip breaking.

    R07Spindle on after M05.

    R10Retract plane.

    R11Drilling axis.

    R12X distance.

    R13Y distance.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    46/50

    46

    % 404;

    N5 G17 G71 G90 G94 G55;

    N10 T1 L90;

    N15 G00 D5 Z5 M3 S600 X62 Y62;

    N20 G81 R02=5, R03=-27, R11=3, F50; N25 G00 G80 Z100 M9;

    N30 T2 L90;

    N35 G00 D10 Z5 M3 S600 X62 Y62;

    N40 G81 R02=5, R03=-30, R11=3, F50 M7;

    N45 G00 G80 Z100 M9;

    N50 T3 L90;

    N55 G00 D15 Z5 M3 S600 X62 Y62;

    N60 G81 R02=5, R03=-33, R11=3, F50 M7;

    N65 G00 G80 Z100 M9;

    N70 T4 L90;

    N75 G00 D20 Z5 M3 S800 X62 Y62;

    N80 G86 R02=5, R03=-33, R04=1,R07=3, R10=60, R11=3, R12=0.1,

    R13=0.1, F50 M7;

    N85 G00 G80 Z100 M9;

    N90 M02;

    DO-LOOPS

    In a few jobs some portion of the programme needs to be repeated, which do not fit into

    standardized category. Some of the non-standardized cycles are Do-loops and Subroutines. Do-

    loop is a number of operations repeated over a number of equal steps for a previously fixed

    number of times.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    47/50

    47

    Do-loops always are implemented on incremental mode because each previous position becomes

    reference for next iteration. Do-loop is actually jumping back to an already written initial portion

    of the program for the number of times a loop count.

    Example1 (Do-loop) (All dimensions are in mm).

    Figure 25: Do-loop

    % 500;

    N2 G71 G90 G94;

    N4 G92 X0 Y0 Z0;

    N6 T1 M06;

    N8 G81 G99 X5 Y10 Z-8 R.2 F100 S500 M03 M08; (Canned Drill cycle)

    N10 G51 P4; (Start loop 4 times)

    N12 G91 X 10;

    N14 G50;

    N16 G80 G90 M09; (Cancel cycle)

    N18 T2 M06;

    N20 G81 G99 X5 Y10 Z-8 R.2 F100 S500 M03 M08; (Canned Drill cycle) N22 G51 P4; (Start

    loop 4 times)

    N24 G91 X 10;

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    48/50

    48

    N26 G50;

    N28 G80 G90 M09; (Cancel cycle)

    N30 M30;

    SUBROUTINE

    A subroutine is a portion of a programme, complete in itself, which is stored in computer after

    programming once. It is called with required data when required again in a programme.

    Example1 (Subroutine) (All dimensions are in mm).

    Figure 26: Subroutine

    %1001;

    N2 G17 G71 G94 G90 G54;

    N4 T1 L90;

    N6 G00 D5 Z5 M3 S500 X9 Y16;

    N8 G01 Z0 F500;

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    49/50

    49

    N10 L100 P1; (Call the subroutine)

    N12 G00 X34 Y16;

    N14 G01 Z0 F500;

    N16 L100 P1; (Call the subroutine)

    N18 G00 X9 Y41;

    N20 G01 Z0 F500;

    N22 L100 P1; (Call the subroutine)

    N24 G00 X34 Y41;

    N26 G01 Z0 F500;

    N28 L100 P1; (Call the subroutine)

    N30 G00 Z100;

    N32 M02;

    Subroutine Programme is below :

    L100;

    N2 G01 G91 Z-1.5 F100 M7;

    N4 X7;

    N6 Y-7;

    N8 X-7;

    N10 Y7;

    N12 G00 G90 Z5 M9;

    N14 M17;

    This has been called as a subroutine in the main programme as above.

  • 7/27/2019 Introduction to Cnc Programming and Industrial Robotics

    50/50