0% found this document useful (0 votes)
5 views18 pages

Unit 4

Mechanical engineering
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views18 pages

Unit 4

Mechanical engineering
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

UNIT 4 FUNDAMENTALS OF PART

PROGRAMMING
Structure
4.1 Introduction
Objectives

4.2 Part Programming Fundamentals


4.3 Manual Part Programming Methods
4.4 Preparatory Functions
4.5 Miscellaneous Functions, M
4.6 Summary
4.7 Answers to SAQs

4.1 INTRODUCTION
In Units 1 to 3, we have discussed the fundamental principles involved in the operation of
computer numerical control machine tools. In this unit, we will study some fundamental
aspects related to programming the CNC machines. Later units will concentrate on the
application of these for industrial components.
Objectives
After studying this unit, you should be able to learn the
• fundamental principles to be observed in programming the CNC machine
tools,
• various programming principles that need to be considered while
programming the CNC machine tools,
• description of some of the commonly used preparatory or G codes used for
controlling the part programming, and
• description of some common miscellaneous or M codes that are used in most
of the CNC machine tools.

4.2 PART PROGRAMMING FUNDAMENTALS


As discussed earlier, the numerical control machine tools require a part program to
generate the requisite geometric shape of the components. The part program is basically a
detailed step-by-step procedure that gives the necessary instructions to the various parts
of a CNC machine tool, to produce the part. Thus, the actual utilization of the machine
tool is as good as the part program that runs it. Hence it is a very important component in
the use of CNC machine tools, to be able to write good part programs. In this unit, we will
develop various elements that would help in writing the part programs for CNC machining
centers.
To develop a part program, it is necessary to follow a series of steps in a proper sequence
to come up with a satisfactory program. It is possible to make the same part by any
number of procedures, but the one that uses the least amount of time and resources, will
be the best program. In order to achieve this, part programmer need to have sufficient
amount of knowledge in a number of associated disciplines, such as machining and
mathematics. The following are some of the steps that are detailed below :
5
Part Programming The first step is to identify the various operations and surfaces that need to be machined
in order to get the final shape of the part. This is termed as process planning. The process
plan of a component in conventional machining consists of machine tool used, work
holding fixtures required, and the sequence of operations. Additionally, for each of the
operation, it is also necessary to identify the cutting tools required along with the process
parameters such as cutting speed, depth of cut, and feed rate. A typical process plan is
shown in Table 4.1 for the part to be machined as shown in Figure 4.1.
80
27.5
6 6
3

40 3

80

Ø3 Ø12 25

12 R3
1
30 9.5

Figure 4.1 : A Typical Component for NC Machining

The next step involved will be the identification of the datum on the part that can be linked
to the datum of the chosen CNC machine tool. The identification of the axes system of
CNC machine tools is discussed in Unit 1. The part programmer will have to identify the
datum and axes on the part in tune with that on the CNC machine tool. It is not necessary
that the part datum and machine datum be the same, which is more difficult for operation.
The CNC machine tools generally come with ‘floating datum’ whereby the part datum
can be located anywhere in the machine tool’s operation space.
Table 4.1 : Process Plan for the Component Shown in Figure 4.1

Op. No. Description Tools

10 Drill five holes, φ12 × 9.5 mm HSS twist drill, φ12 mm


20 End mill slot, 12 × 30 × 1 mm Slot drill, φ6 mm
30 Drill twenty holes, φ3 × 6 mm HSS twist drill, φ3 mm

Care has to be taken in identifying the axes system, since the calculation of the coordinate
values will be greatly affected by that choice. Generally there are two possibilities to
locate the datum :

• Lower left hand corner of the part as viewed in X-Y plane,

• The geometric center of the part in case of a component geometry that is


highly symmetrical.
Each of these have certain advantages in their own right.
In the first case, when the datum is chosen as the lower left hand corner of the part as
shown in Figure 4.2, you are keeping the entire part in the first quadrant of the coordinate
system. This helps in the sense that all the dimensions would remain as positive , so less
likely to make mistakes while entering the part program into the controller. At least in the
initial stages, till the part programmer gains sufficient experience, it is desirable that he/she
6
chooses this form of datum selection. Another advantage of this system is that the setting Fundamentals of
Part Programming
of the component on the machine tool table is readily done by touching the two edges.

80
67.5
52
Y 46
40
34
28
6

80
65 68
Ø12 62
Ø3
40

12 15
R3
X 1
9.5
12.5

Figure 4.2 : Same Part as in Figure 4.1 with Axes System at the Bottom Left Corner

Alternatively the datum could be chosen as a point that is located at the geometric centre
of the workpiece for symmetrical workpieces as shown in Figure 4.3. This helps in
reducing the geometric calculations needed since you will be doing that only for one half
or one quarter of the component and the rest could be manipulated by a simple sign
change. Further, it would be possible to make use of the mirror facility in the controller to
reduce size of the part program.

Y
12
6 6

40
28
22 25

X
Ø3 Ø12

R3
1
9.5
27.5

40

Figure 4.3 : Part for NC Machining Shown with Axes System


at the Geometric Centre for a Symmetrical Component

When it comes to the Z-axis datum, the option is relatively simple. It is generally kept to
match with the top surface of the workpiece. This can be easily set as well as all the
positive Z-motions will take the tool away from the workpiece, thereby avoiding any
catastrophic collisions of the tool with workpiece in case of any errors in the part
program.

7
Part Programming After the datum selection, the next choice is that of cutting tools such that the most
effective and economical tools are selected for the operation. Only the general purpose
tools are used as far as possible, unless a required surface cannot be generated by them.
Also the size of the tools have to be carefully selected from the geometry in question.
For a given tool and the operation selected, the appropriate process parameters are to be
selected. These are to be generally taken from the handbooks supplied by the cutting tool
manufacturers or based on the shop experience. Another aspect to remember is the
planning of the various cuts, when large amount of material needs to be removed, for
example in the case of cavity milling. This aspect is generally taken care of by the canned
cycles, which will be discussed later.
The proving of a part program before that can actually cut metal is important. This is done
in many ways. One of the simplest is the graphical proving of the part by a software on
the computer screen or on the MCU monitor. A typical example is shown in Figure 4.4
below.

Figure 4.4 : Tool Path of the Part for Proving the NC Part Program

After the graphical verification, a dry run on the machine tool may be carried out without
a cutting tool to make sure that there are no unwanted motions present in the program.
After a successful dry run, it would be possible to run the part program to make the part.
If in doubt, the first component may be made in a soft material such as machinable wax,
acrylic, nylon or Styrofoam. Having proven the part program, it can be released for
production with appropriate documentation.
SAQ 1
(a) In order to write CNC part programs, what are the various types of
information that needs to be considered by a part programmer?
(b) What is a process plan?
(c) How is the datum selected in the case of CNC part programming? Explain
your answer with examples.
(d) Explain the importance of part program verification.

8 4.3 MANUAL PART PROGRAMMING METHODS


It is necessary to have a specified format or language that should be used to write the Fundamentals of
Part Programming
part programs. It would be preferable to use a language that is close to English, but that
would make the language interpretation more difficult. Hence, the part programming
language used universally by the CNC controllers is the ‘Word Address Format’ that
relies on providing a character address for each of the number that is specified in the part
program block. Prior to this a number of formats such as fixed sequential and tab
sequential format have been tried that are no more in use. A typical block in the word
address format is given below :
N050 G01 X10.45 Y75.0 Z-8.0 F150 M3;
The meaning of these parameters is explained below :
N050 refers to the block number 50
G01 refers to a preparatory function 1 for linear interpolation
X10.45 refers to X coordinate value 10.45 units
Y75.0 refers to Y coordinate value 75.0 units
Z-8.0 refers to Z coordinate value -8.0 units
F150 refers to a feed rate of 150 units/min
M3 refers to a miscellaneous function value of 3 that starts the
spindle
in the clockwise direction
; refers to the end of block
The complete part program is broken down into a number of blocks each of which
consists of a number of words as given above. Each of the block refers to a set of
instructions that can be simultaneously executed. Each block generally starts with a block
number that can be used as a label and is programmed with a N word address. This may
be followed by a number of words as required.
From the beginning of the CNC era, standardisation played an important role in simplifying
the programming where a large number of manufacturers are involved. The EIA
(Electronics Industries Association) and ISO (ISO 2539) have carried out the
standardization and most of the manufacturers follow these. As per the ISO standard, all
the 26 letters of the English alphabet were standardised and given meaning as follows:
Character Address For
A Angular dimension around X axis
B Angular dimension around Y axis
C Angular dimension around Z axis
D Angular dimension around special axis or third feed function*
E Angular dimension around special axis or second feed function*
F Feed function
G Preparatory function
H Unassigned
I Distance to arc centre or thread lead parallel to X
J Distance to arc centre or thread lead parallel to Y
K Distance to arc centre or thread lead parallel to Z
L Do not use
M Miscellaneous function
N Sequence number
9
Part Programming O Reference rewind stop
P Third rapid traverse dimension or tertiary motion dimension parallel to X*
Q Second rapid traverse dimension or tertiary motion dimension parallel to Y*
R First rapid traverse dimensio n or tertiary motion dimension parallel to Z*
S Spindle speed function
T Tool function
U Secondary motion dimension parallel to X*
V Secondary motion dimension parallel to Y*
W Secondary motion dimension parallel to Z*
X Primary X motion dimension
Y Primary Y motion dimension
Z Primary Z motion dimension
* Where D, E, P, Q, R, U, V, and W are not used as indicated, they may be used
elsewhere.
The ISO format for a typical block is shown below :
N5 G2 X±53 Y±53 Z±53 U..V..W..I..J..K..F5 S4 T4 M2 ;
N5 This refers to an integer value with a maximum of 5 digits, the maximum value
will be 99999 while the minimum is 1.
G2 This also refers to an integer value with a maximum of 2 digits, the maximum
value will be 99 while the minimum is 0.
X±53 This refers to a real value with a maximum of 5 digits before decimal and 3 digits
after the decimal with an optional sign before the value. The maximum value will
be 99999.999 while the minimum is 0.
Y±53 Same as above
Z±53 Same as above
U..V..W..I..J..K.. Same as above
F5 This refers to an integer value with a maximum of 5 digits, the maximum value
will be 99999 while the minimum is 0.
S4 This refers to an integer value with a maximum of 4 digits, the maximum value
will be 9999 while the minimum is 0.
T4 This refers to an integer value with a maximum of 4 digits, the maximum value
will be 9999 while the minimum is 0.
M2 This also refers to an integer value with a maximum of 2 digits, the maximum
value will be 99 while the minimum is 0.
; This refers to the end of block character
It is not necessary that all these characters are to be used in every block. The sequence
of the characters can also be changed. Here are a few examples that will clarify the use
of these words.
N010 G90 G71 ;
N020 G92 X -50.0 Y-50.0 Z50.0 ;
N030 G00 X8.0 Y8.0 Z2.0;

10
For the sake of simplicity we will be following the ISO format in this course. However, Fundamentals of
Part Programming
the programmer should refer the individual CNC machine program manual to follow the
correct procedures and formats.
The co-ordinates are a major part of a typical part program. The various word addresses
used for specifying coordinates are X, Y, Z, U, V, W, I, J, K, A, B, C, etc. They can be
specified using a direct decimal format as we normally do in algebra. Some examples are:
N035 T01 M03 S1000 ;
N040 G01 X15.450 Y35.540 Z -2.0 F120 ;
N055 X-25.500 Y55.545 ;
N065 X15.450 Y35.540 ;
Generally, the feed rate is specified with F word address and specified in mm per minute.
The value specified normally is the speed with which the spindle moves along the
specified path. For example, F120 in the above statement means that the feed rate is
specified as 120 mm per minute (assuming metric units are used in the program).
However, it is also be possible to specify using the mm per revolution units, with a special
preparatory function as described later. The feed rate specified in any block remains
modal, meaning that it will remain in force till it is altered by another F word. Generally, it
is expected that the axes will be moving at the specifie d rate. However, it is possible to
change this by the use of feed rate override switch on the machine tool control panel.
The spindle speed can be set using the S word address. The number after the S is the
speed of the spindle specified directly in revolutions per minute. For example, S1000 in
the above statement means that the spindle speed is specified as 1000 revolutions per
minute. Though this is the normal usage, it is also possible to specify the spindle speed in
cutting speed units as meters per minute using a special preparatory function, which is
described later.
The tool to be used for an operation is to be identified by the T word address. For
example, T01 in the above statement means that the tool number 1 is to be placed in the
spindle. The tool number is considered in this book as the tool magazine position in the
case of machines with automatic tool changers. The actual case may have to be verified
with the programming manual of the individual machine tool. In some cases the tool
number may also have to be combined with the tool offset register number, which is
described later.

4.4 PREPARATORY FUNCTIONS

The preparatory functions are denoted by the word address ‘G’. This function principally
controls the geometric functions of the controller. Thus, it is mostly associated with the
control of the axes. These are also called as G codes. It generally has two digits, e.g.
G01, G42, and G90 as per ISO specifications. Many of the current day controllers have
extended this to 3 or 4 digits. Most of these functions are standardized by ISO as
follows :
Code Function
G00 Point-to-point positioning, rapid traverse
G01 Line interpolation
G02 Circular interpolation, clockwise (CW)
G03 Circular interpolation, anti-clockwise (CCW)
G04 Dwell
G05 Hold/Delay
11
Part Programming G06 Parabolic interpolation
G07 Unassigned
G08 Acceleration of feed rate
G09 Deceleration of feed rate
G10 Linear interpolation for “long dimensions” (10 inches-100 inches)
G11 Linear interpolation for “short dimensions” (up to 10 inches)
G12 Unassigned
G13-G16 Axis designation
G17 XY plane designation
G18 ZX plane designation
G19 YZ plane designation
G20 Circular interpolation, CW for “long dimensions”
G21 Circular interpolation, CW for “short dimensions”
G22-G29 Unassigned
G30 Circular interpolation, CCW for “long dimensions”
G31 Circular interpolation, CCW for “short dimensions”
G32 Unassigned
G33 Thread cutting, constant lead
G34 Thread cutting, linearly increasing lead
G35 Thread cutting, linearly decreasing lead
G36-G39 Unassigned
G40 Cutter compensation-cancels to zero
G41 Cutter radius compensation – offset left
G42 Cutter radius compensation – offset right
G43 Cutter length compensation – positive
G44 Cutter length compensation-negative
G45-G52 Unassigned
G53 Deletion of zero offset
G54-G59 Datum point/zero shift
G60 Target value, positioning tolerance 1
G61 Target value, positioning tolerance 2, or loop cycle
G62 Rapid traverse positioning
G63 Tapping cycle
G64 Change in feed rate or speed
G65-G69 Unassigned
G70 Dimensioning in inch units
G71 Dimensioning in metric units
12 G72-G79 Unassigned
G80 Canned cycle cancelled Fundamentals of
Part Programming
G81-G89 Canned drilling and boring cycles
G90 Specifies absolute input dimensions
G91 Specifies incremental input dimensions
G92 Programmed referenc e point shift
G93 Unassigned
G94 Feed rate/min (inch units when combined with G70)
G95 Feed rate/rev (metric units when combined with G71)
G96 Spindle feed rate for constant surface feed
G97 Spindle speed in revolutions per minute
G98-G99 Unassigned
Most of the G codes are modal in nature, so that they need not be repeated in every
block. Another point to be noted with these codes is that the G codes are divided into
various groups depending upon their functionality. It is expected that only one code from
each of the group should be given in any given block. It is generally possible to include
more then one G address in one block, provided these functions are not mutually
exclusive. In Fanuc controls upto 5 G codes can be given in one block. Some other
controls have different limits, but generally upto 3 codes in a single block will be
permissible.
It should also be noted that some of the G codes remain in force when the control is
started or reset. These are termed as default or turn on codes. Though it is a prudent
practice, to specify all the necessary G codes while writing the programs, some times it
may be possible by the experienced programmers to take advantage of these default
codes and reduce the length of the program.
Typical preparatory functions that are generally present in most of the machining centres
are given below :
Motion group
*G00 Rapid Positioning
G01 Linear Interpolation
G02 Circular interpolation Clockwise
G03 Circular interpolation Counter clockwise
Dwell
G04 Dwell
Active Plane Selection Group
*G17 XY Plane selection
G18 XZ Plane selection
G19 YZ Plane selection
Cutter Compensation Group
*G40 Cutter compensation, Cancel
G41 Cutter radius Compensation left
G42 Cutter radius Compensation right 13
Part Programming Units Group
*G70 Inch units
G71 Metric units
Hole Making Canned Cycle Group
*G80 Canned Cycle Cancel
G81-G89 Canned Cycles definition and ON
Co-ordinate System Group
*G90 Absolute co-ordinate system
G91 Incremental co-ordinate system
Preset
G92 Absolute pre-set, Change the datum position
The * sign indicates the generally accepted default or turn on code in operation. However,
this is not generally true with all the controllers and care have to be taken to check with
the programming manual of the controller.
SAQ 2
(a) Explain the word address format that is generally used with CNC machining
centers.
(b) Explain the procedure used to specify the feed rate and spindle speed in the
case of CNC machining centers.
(c) What is the importance of preparatory functions in CNC machining center
programming? Give the description of any two functions and their
application.

Co-ordinate System Group, G90 and G91


The coordinate data can be input into the program either in the absolute or in the
incremental system. The absolute coordinate system is indicated by the preparatory
function G90. In absolute system, the dimensions are given with respect to a
common datum established by the programmer. Refer to Figure 4.5, where the
point O is the datum with OX being the X-axis and OY the Y-axis.

14
Fundamentals of
Part Programming

Figure 4.5 : Absolute (G90) and Incremental (G91) Systems

Suppose the route to be 0-A-B-C-D in absolute programming system, then the


programming will be as follows :
N010 G90 G01 X5.0 Y15.0 F200; Point A
N015 X15.0 Y20.0; Point B.
N020 X25.0 Y15.0; Point C
N030 X35.0 Y10.0; Point D
G90 code is modal and will remain in force till it is cancelled by another code from
the same group, i.e. G91 for incremental programming.
When the order of movement changes, the actual programming of the coordinates
is not affected in the absolute programming mode. Suppose the route to be
0-A-C-B then the following programming will be used :

N010 G90 G01 X5.0 Y15.0 F200; Point A


N015 X25.0 Y15.0; Point C
N020 X15.0 Y20.0; Point B.
In the case of incremental programming, the G-code used is G91. In the
incremental programming, the actual distance moved by the tool from the current
position is programmed. Unlike as with G90, the programmed data changes only if
the route of the move is altered. Referring back to Figure 4.5, the program for
route 0-A-B-C would be
N010 G91 G01 X5.0 Y15.0 F200; Point A
N015 X10.0 Y5.0; Point B.
N020 X10.0 Y -5.0; Point C
When route is changed to 0-A-C-B, then the program will have to be rewritten as
follows :
N010 G91 G01 X5.0 Y15.0 F200; Point A
N015 X20.0 ; Point C
N020 X-10.0 Y5.0; Point B.
While writing NC program in incremental mode, care has to be taken to designate
the actual movement of the tool in the positive or negative axis direction. This is
true even when the movement of the tool is in the first quadrant as in Figure 4.5,
still some of the movements have been identified as negative because the tool is
moving in the negative axis direction. Thus, more care is needed in incremental
15
Part Programming programming. It is generally suggested that a fresh programmer may stick to
programming in absolute system in the beginning. This will help in reducing the
possible mistakes in specifying the coordinates. Any error in coordinates in absolute
programming will result in only an error in that block, while in the case of
incremental programming the error will continue further down in all subsequent
blocks.
With experience the programmer may find that the incremental programming
requires less calculations in arriving at the programming dimensions, while for
absolute programming a number of dimensions need to be recalculated from the
chosen datum, if the part drawing is not properly dimensioned. It is possible to write
in a given program, both absolute and incremental systems. However, care has to
be exercised by the programmer to arrive at the coordinate dimensions according to
the chosen dimensional system.

Units Group, G70, G71


Normally NC programs can be written in either inch units or mm units. It is
necessary to specify the units with a G code. G70 stands for programming in inch
units while G71 stands for programming in mm units. A given program should be
written only in either inch or mm units. Hence only one of the two codes should be
present in one program. Sometimes in Fanuc controls normally G20 and G21 are
used for the units in place of G70 and G71.
Active Plane Selection Group, G17, G18, G19
Some G-codes in the NC control are expected to work only in a plane rather than
in the 3D space. This set of codes are used for selecting the active plane. The
active plane selection codes are shown in Figure 4.6.

Figure 4.6 : Plane Selection for Vertical Axis Milling Machines

G17 XY Plane selection


The G17 code allows for the tool to move in the horizontal plane in case of vertical
axis milling machines as shown in Figure 4.6.
G18 XZ Plane selection
16 This allows the working to be carried out in XZ plane (Figure 4.6).
G19 YZ Plane selection Fundamentals of
Part Programming
This allows the working to be carried out in YZ plane (Figure 4.6).
Preset, G92
This code is used to specify the component datum of the part that will be fixed by
the part programmer. This may sometimes be also called as ‘Program Zero Point’.
The tool will be set at this point and the X,Y and Z coordinate registers of the
controller will be initialized to this value. Depending upon the point being touched,
the co-ordinate can be specified.
N015 G92 X100.0 Y150.0 Z50.0;
The other code s used for datum setting are G53 to G56. These codes are useful for
setting a number of datum positions on the machine table that could be used for
machining multiple workpieces.
Motion Group, G00, G01, G02, G03
Of all the G-codes available in a controller these are the most widely used codes in
a given program. All the codes in this group are modal and can be cancelled by any
of the codes within the group.
Rapid Positioning, G00
This code is used for specifying the movement at the maximum possible feed rate.
The tool is normally moved at the maximum possible feed such as 8000 or
40 000 mm/min along the axes involved for achieving the position programmed. In
this code the path taken by the tool to reach the programmed point is not important
since the tool is not supposed to do cutting during this code.
Referring to Figure 4.7, the tool is currently at position A and it is required to move
it to position B. For this, the program block in absolute coordinates would be
N15 G90 G00 X80.0 Y15.0;
Y

A
40

45°
20
C B

0 X
0 20 40 60

Figure 4.7 : Positioning, Preparatory Function G00

The path of the tool from A to B can be either through the shortest path, or
alternatively the tool will start moving in all axes at the maximum speed possible
thereby going through a 45 path as shown in Figure 4.7. When one of the
coordinates is satisfied, then the tool will start moving in the other axis till the
programmed position is satisfied. Though the above example shows a movement in
two axes, it is also possible to have the same in all three axes simultaneously.
The program block in incremental coordinates would be
N15 G91 G00 X60.0 Y-30.0;
Linear or Straight line Interpolation, G01
17
Part Programming Linear or Straight line Interpolation is generally used when the material is being cut
by the cutting tool. In this case, the tool will move along the programmed straight
line with the specified feed rate. In this case, the controller moves all the three axes
at a rate such that the resultant velocity along the line matches the programmed
feed rate.

Figure 4.8 : Linear Interpolation, Preparatory Function G01

Absolute programming O to A to C to B (Figure 4.8)


N110 G90 G00 X10.0 Y45.0 Z2.0
N115 G01 Z -8.0 F300;
N120 X40.0 Y15.0 ;
N125 X70.0;
Incremental programming O to A to C to B (Figure 4.8)
N110 G91 G00 X10.0 Y45.0 Z2.0
N115 G01 Z -10.0 F300;
N120 X30.0 Y -30.0 ;
N125 X30.0;
Circular Interpolation, G02 / G03
Circular interpolation is used to generate arcs in a single plane. The codes used are
G02 for clockwise motion and G03 for anti-clockwise motion. The direction of
motion is established by looking in the negative direction of the axis perpendicular to
the plane. The format to be used is
G02 X--—Y--—I--—J--
Here X and Y refer to the end point of the arc, while I and J are position of the
center measured incrementally from the start point of the arc. I refers to the
distance along X-axis while J is for the motion along Y-axis. I and J are always
specified in incremental whether the program is written in absolute or incremental
programming.
Referring to Figure 4.9, when the motion is from A to B in XY plane, the program
block would be, as per ISO,
N125 G02 X30.0 Y45.0 I20.0 J0 F250;
18 But, if the motion were from B to A, then it would be
N125 G03 X10.0 Y25.0 I0 J-20.0 F250 Fundamentals of
Part Programming

Figure 4.9 : Circular Interpolation, Preparatory Function G02/G03

It is also possible to specify the radius of the arc in place of the center coordinates
using I and J. In that case, R word address is used for specifying the radius. The
specification will then be for the above case,
N125 G02 X30.0 Y45.0 R20.0 F250;
However, looking at Figure 4.10, it can be noticed that there are two possible arcs
that can be drawn using the given information, since the center of the arc is not
precisely located. It can be noticed that one arc is smaller (less than 180°) and the
other larger (greater than 180°). To check for the correct arc, the nomenclature as
adopted is that the radius of the larger arc is specified with a negative sign for the
radius.

B
R-20
40

R20
20 A C

0 X
0 20 40 60

Figure 4.10 : Circular Interpolation using R Word Address

It is possible to draw a complete circle using the circular interpolation commands


G02 and G03. However, in that case the center of the coordinates should be
specified using I and J and not by the radius, R. If radius is to be used, then the arc
may be broken into semi-circles and would have to be programmed in two blocks.
Above example used the default XY plane. It is also possible to use the plane
selection codes to draw arc in XZ and YZ planes with G18 and G19 respectively.
Dwell, G04
G04 is used to specify a programmed delay in the program. At the point in the
program where a G04 code is encountered, the controller stops for the specified
time programmed in the block. After the specified delay, the controller
automatically continues to execute the next block in the program. 19
Part Programming N045 G04 X3.0; This calls for a stoppage of the control for a
period of 3 seconds.
N045 G04 P3000; This calls for a stoppage of the control for a
period of 3 seconds. No decimal point
programming with P word address in Fanuc
controls.

4.5 MISCELLANEOUS FUNCTIONS, M

The miscellaneous functions or M-codes are the ones used for operating the machine tool
functions. Generally, only one -M code is supposed to be given in a single block.
Similar to G-codes, ISO has standardized a number of M-codes as follows :
Code Function
M00 Program stop, spindle and coolant off
M01 Optional programmable stop
M02 End of program – often interchangeable with M30
M03 Spindle on, CW
M04 Spindle on, CCW
M05 Spindle stop
M06 Tool change
M07 Coolant supply No. 1 on
M08 Coolant supply No. 2 on
M09 Coolant off
M10 Clamp
M11 Unclamp
M12 Unassigned
M13 Spindle on, CW (+) coolant on
M14 Spindle on, CCW (–) coolant on
M15 Rapid traverse in + direction
M16 Rapid traverse in - direction
M17-M18 Unassigned
M19 Spindle stop at specified angular position
M20-M29 Unassigned
M30 Program stop at end tape + tape rewind
M31 Interlock by-pass
M32-M35 Constant cutting velocity
M36-M39 Unassigned
M40-M45 Gear changes; otherwise unassigned
M46-M49 Unassigned
M50 Coolant supply No. 3 on

20 M51 Coolant supply No. 4 on


M52-M54 Unassigned Fundamentals of
Part Programming
M55 Linear cutter offset No. 1 shift
M56 Linear cutter offset No. 2 shift
M57-M59 Unassigned
M60 Piece part change
M61 Linear piece part shift, location 1
M62 Linear piece part shift, location 2
M63-M67 Unassigned
M68 Clamp piece part
M69 Unclamp piece part
M70 Unassigned
M71 Angular piece part shift, location 1
M72 Angular piece part shift, location 2
M73-M77 Unassigned
M78 Clamp non-activated machine bed-ways
M79 Unclamp non-activated machine bed-ways
M80-M99 Unassigned
In the following a few of the M-codes that are generally found in most of the controllers
are described. The other M-codes should be checked in conjunction with the
programming manual of the machine tool.
M00 Program stop or Pause. This would stop the machine after completing the
instructions in the block. To continue further, the operator will press the ‘Start’
button on the control panel. This is generally useful for altering the clamp position
or inspection.
M01 This is similar to above and is termed ‘Optional stop’. This will stop like
M00 when the “Optional stop” switch on the controller is ‘ON’. This is normally
used for random inspection.
M02 This is logical ‘End of program’.
M03 This is the function to start the machine spindle in the clockwise direction.
When it is given in a block would be the first code to be executed before all the
other codes in a block are acted upon.
M04 This is the function to start the machine spindle in the counter clockwise
direction. When it is given in a block would be the first code to be executed
before all the other codes in a block are acted upon.
M05 This is used to stop the machine spindle. When it is given in a block
would be the last code to be executed after all the other codes in a block are
acted upon.
M06 is for tool change.
M07 is for ‘Coolant 1 On’.
M08 is for ‘Coolant 2 On’.
M09 is for ‘Coolant Off’.
M30 This is also the ‘End of program’ and is called ‘Rewind’.
Program Number 21
Part Programming Generally, it is necessary to specify an identification for each of the program in
terms of a program number. The symbol used for the program number in Fanuc
controls is “O” or “:”, followed by its number. For example, O238 or : 238. The
programs are generally stored in the CNC controller memory using the program
number.
SAQ 3
(a) Explain the differences and application of absolute and incremental
programming system in CNC applications.
(b) What are the various forms of specification used for radius/centre with the
circular interpolation?
(c) Briefly explain the purpose of miscellaneous functions (M-codes) in CNC
programming. Give any two codes with their application.

4.6 SUMMARY

CNC Part program is a detailed step by step procedure for carrying out the actual
machining operation in a CNC machine tool. In order to develop a good part program, the
part programmer needs to follow precise steps in a sequence. First step is to identify the
coordinate system to be used with the part that will specify how the coordinates will be
measured. Once the program is written, it is also necessary to prove it before actually
committing the machine tool to machine the part. Word address format is generally used
to translate the machining sequences into a language understood by the CNC controller.
The numerical values in a part program are preceded by a character that specifies its
address. ISO has standardized the word addresses to be used in CNC part programming.
Preparatory functions are G codes which are used to signify the way the part program
needs to be interpreted. There are a number of them that have been standardized and
commonly used in most of the controllers. Miscellaneous functions refer to the codes that
activate mainly the functions of the machine tool.

4.7 ANSWERS TO SAQs


Refer the preceding text for Answers to SAQs.

22

You might also like