me0423

40
ME 0423 Computer Aided Manufacturing Laboratory STUDENT NAME : REGISTERATION NUMBER : DEPARTMENT OF MECHANICAL ENGINEERING 2012 2013 SRM UNIVERSITY (UNDER SECTION 3 OF THE UGC ACT, 1956) VADAPALANI, CHENNAI-600 026

Upload: dinesh-kumar-jd

Post on 04-Apr-2018

216 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 1/40

ME 0423

Computer Aided Manufacturing Laboratory

STUDENT NAME :

REGISTERATION NUMBER :

DEPARTMENT OF MECHANICAL ENGINEERING

2012 – 2013

SRM UNIVERSITY

(UNDER SECTION 3 OF THE UGC ACT, 1956)

VADAPALANI, CHENNAI-600 026

Page 2: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 2/40

SRM UNIVERSITY

(UNDER SECTION 3 OF THE UGC ACT, 1956)

VADAPALANI, CHENNAI-600 026

BONAFIDE CERTIFICATE

REGISTER NO:

Certified to be the Bonafide Record of the work done by

 _________________________ of ___ Semester/____ Year B.TECH degree course in the

practical Computer Aided Manufacturing Laboratory  in SRM UNIVERSITY, Vadapalani

during the academic year 2012-2013.

Date: Staff Incharge Head of the Department

Submitted for University Examination held in Computer Aided Manufacturing Laboratory  

held on ___________ SRM UNIVERSITY, Vadapalani. 

Date Internal Examiner External Examiner

Page 3: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 3/40

INDEX

Exp

NoDate Title of The Experiment

Page

No.Signature

Page 4: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 4/40

INTRODUCTION TO CNC MACHINES

Numerical Control Systems (NC-Systems)

Controlling the movement of the various slides of a machine tool with the help of numbers,

letters and symbols is known as Numerical Control Systems (NC). The NC system forms the basis of 

programmed automation in manufacturing.

The concept of NC Systems was conceived in the late 1940s, and the concept was

demonstrated in the year 1948. The first demonstration of the NC prototype was held in 1952.

In NC system, punched tape is used to enter program of instructions. The program is entered

by punching holes in different positions. A tape reader is used to read the program of instructions

contained in the tape.

There were number of problems encountered in using NC system. Among them punched tape and

Tape reader causes main problems such as

1.  Repeated use of tape causes wear and tear and become un-reliable.

2.  The tape must be used each time the component is to be produced.3.  Error during entering a program by punching holes cannot be rectified. The tape has to be

thrown out and a new tape has to be prepared.

4.  It does not provide any flexibility.

Because of these inherent problems encountered in NC system, machine tool builders were

motivated to seek improvements in the conventional NC system.

Computer Numerical Control System (CNC) 

The use of a dedicated computer, to perform the Basic numerical control functions is known as

Computer Numerical Control system (CNC). The CNC provides a high degree of flexibility and

computational capability in Computer Aided Manufacturing (CAM).Advantages of CNC:

  Part programs are stored in the computer itself.

  Punched tape & tape reader is used only once to enter program into the computer memory.

  The part programs can be easily edited.

  It is easy to convert program written in one unit to another unit such as imperial to metric unit

and vice versa.

  Repeated operations can be stored as sub-routine.

  Advanced programming ability like mirroring, sub-routine etc.

  Ability to store tool offset and tool compensation.

  Greater flexibility in manufacturing.

  Improved quality control.

Study of Turning:

CNC Turning Centre:-

CNC Lathes are more appropriately called as Turning Centre. The turning centers are meant

for producing components of cylindrical shape. Most of the turning centre’s are equipped with slant

bed to allow for better view of the machining plane and for easy placement of various devices in the

machining zone. Most of the turning centers are provided with tool turret, which can hold 8 to 12

tools of various types.

Page 5: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 5/40

The CNC-turning centers are classified as follows.

  Vertical turning centers

  Turn mill centers

  Multiple axis turning centers

  Twin turret turning centers

  Multiple spindle turning centers

Study of Milling:

CNC Milling Machines or Machining Centre:-

The CNC milling machines are called as machining centers or Manufacturing centers. The machining

centre is a multi functional machine tool. It is a single piece of Automated production equipment,

which is capable of performing different operations like milling, drilling, boring, reaming, counter

boring etc.

The machining center is equipped with a tool magazine which can hold up to 400 different tools. The

machining center is also equipped with automatic tool changer (ATC). The ATC picks p the

programmed tool from the magazine and fix it to the spindle.The work holding system normally employed in a Machining Center includes

1.  Pallet System

2.  Fixtures

The tooling system normally employed in a Machining Center includes a Tool Magazine with ATC.

Page 6: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 6/40

Introduction to CNC Programming:

Part Programming:

“Part” means component. “Program” means sequence of steps. Therefore the sequence of steps

involved in producing a component in a CNC machine is known as part program. 

Methods of Creating Part Programs:The different methods of creating part programs are

  Manual part programming

  Computer assisted part programming

  Automatically Programmed Tool (APT) Programs

  Conversational program

  Graphics program

  Verbal program

Data required for programming:

The following data(s) are required for NC part programming.

  Relative positioning of tool with respect to the work piece (x, y and z co-ordinate position)

  Preparatory commands (G-codes) like interpolation etc.

  Miscellaneous instructions (M-codes) like spindle On/Off, tool change etc.

  Unit of programming like mm or inch

  Method of dimensioning like absolute or relative

  Feed

  Depth of cut

  Types of tool

  Sequence of operations etc

NC-related dimensioning:There are 2-methods of dimensioning system in part programming.

  Absolute dimensioning system

  Relative dimensioning system

Absolute Dimensioning: In absolute dimensioning, the distance of different points are measured from

a fixed origin.

Relative or Incremental Dimensioning: In relative dimensioning, the distances of different points are

measured by taking the previous point as the origin.

The above 2-methods of dimensioning are illustrated below.

Points X YP1 0 0

P2 30 0

P3 30 20

P4 20 45

P5 0 45

P1 0 0

Page 7: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 7/40

Points X Y

P1 0 0

P2 30 0

P3 0 20

P4 -10 25P5 -20 0

P1 0 -45

Structure of a CNC Program:

  A CNC program consists of number of Blocks (each line is called a Block)

  Each Block consists of Number of words

  The first few Blocks are related to machine controller settings, called “program start-

up”, which include 

o  Program number- the first letter is “O” which is followed by a 4-digit number

like O1001, O1005, etc.

o  Work piece dimension (Billet size)

o  Unit of programming (inch/mm), feed (mm/min or mm/rev), cutter

compensation cancel, etc.

o  Reference point return

o  Code for tool change

o  Setting the actual spindle speed

  Next few Blocks from the “body of the program”, which specify the tool path in

producing the component.

  Last few Blocks forms “End of the program”, which include

o  Reference point return

o  Stop the spindle rotation

o  Program stop and rewind

Syntax of a Block in a CNC Program

N G X Y Z F S T M ;

N - Block Number (optional)

G - Preparatory Code

X, Y, Z - Co-ordinate Positions

F - Feed

S - Spindle Speed

T - Tool Function

M - Miscellaneous functions

; - End of Block 

Part Programming Formats:

A CNC program consists of a Number of Blocks. Each block consists of number of words. The orderin which each word appear in a block is called Format. There are 2-Types of Format.

Page 8: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 8/40

a)  Fixed Format

a.  Fixed Sequential Format

b.  Tab Sequential Format

b)  Word Address Format

Fixed Sequential Format: In this Format, each Block contains all the words. That is each word is

repeated in every block in the same sequence, even though they are same as in the previous Block. It

requires more money.

Ex: N10 G00 X15 Y10 Z2 F50 S1200 EOB

N20 G01 X15 Y10 Z-5 F50 S1200 EOB

Tab Sequential Format: In this Format, each word in a Block is preceded by the “TAB” character.

But, if the words in the succeeding Blocks are same as that of the words in the previous Block, then

that word is omitted without being repeated.

Ex: N10 G00 X10 TAB Y8 TAB Z0 TAB F50 TAB S1200 EOB

N20 G01 Z-5 TAB S1000 EOB

Word Address Format: In word address format, if the words in the succeeding Block are same as that

of the words in the previous Block, then those words need not be repeated. Moreover, the “TAB”

character is also omitted in this type of format. Hence it requires very less memory and is adopted by

most CNC machine control units.

Ex: N10 G00 X10 Y8 Z1 F50 S1200 EOB

N20 G01 Z-5 S1000 EOB

Interpolation: In CNC machines, either the tool or the work slide moves relative to each other. This

movement of tool or the work slide may be in straight line, circular arc, and parabolic arc or in some

other way called Interpolation.

Types of Interpolation are:

  Linear Interpolation

  Circular Interpolation

  Parabolic Interpolation

  Logarithmic Interpolation

  Exponential Interpolation

Linear Interpolation (G01): The movement of tool or the work slide in a straight line is called linear

interpolation. The movement may be parallel to any one of the axes or simultaneous movement in

more than one axis in an inclined straight line.

*The code used for Linear Interpolation is G01Circular Interpolation (G02 & G03): The movement of tool or the work slide along a circular path or

in an arc of a circle is called Circular Interpolation. This movement may be either in clockwise

direction or anti-clockwise direction each having different G-codes, which are discussed in later

articles.

Canned Cycles: The canned cycle is employed for stock removal (metal removal) in multiple passes.

In CNC machining, sometime it may become necessary to perform the same set of motions repeatedly

for number of times in different positions. It is therefore possible to define a canned cycle or fixed

cycle for the cases like this.

The canned cycle performs a set of motions repeatedly for many times using one or two blocks

instead of several blocks.

Page 9: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 9/40

The canned cycle is employed for

i.  Box Turning Cycle

ii.  Box Facing Cycle

iii.  Multiple Turning Cycle

iv.  Peck Drilling Cycle etc;

v.  Grooving Cycle

Sub-Routines: Sub-routine is one of the advanced programming abilities, by which we can make use

of a part of the program repeatedly for number of times in a particular program as well as in other

programs.

Subroutine is a small independent program, which is stored in the memory with separate name and

forms a part of the main program. The sub-routine contains sequence of operations, which are

repeatedly performed in a main program.

The subroutine is invoked into a main program by means of a special code (M98) and the subroutine

is terminated by another code (M99) and the control is immediately transferred to the statement

following “M98” in the main program. Syntax of Sub-Routine

Mode of Execution

Standardization of Word Address Letters: As we know already, a part program consist of number

of Blocks, each Block consisting number of words. A word is a collection of Address letter followed

by a sequence of numbers. The address letters are standardized English

Page 10: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 10/40

Alphabets as listed below:

Character Meaning

A Rotation about X-axis

B Rotation about Y-axis

C Rotation about Z-axisD & E Rotation about additional axes

F Feed function

G Preparatory function

H Unassigned

I Interpolation parameter/Threadpitch parallel to X-axis

J Thread pitch parallel to Y-axis

K Thread pitch parallel to Z-axis

L Unassigned

M Miscellaneous function

N Block numbers

O Used to assign program number

P, Q, R Thread movement parallel to X,Y & Z axes respectively.

P & Q are also used asparameters in cycles

S Spindle speed function

T Too function

U, V, W Second movement parallel to X,Y, Z axes respectively

X Movement in X-axis

Y Movement in Y-axis

Z Movement in Z-axis

Preparatory Functions (G-Codes): The preparatory functions are popularly known as G-codes. It is

a preset function associated with the movement of machine axes and the associated geometry. A G-

code is always followed by 2-digit number like G01, G41, etc. a complete list of G-codes of turning

and milling are tabulated below:

G-Code Function

G00 Rapid Traverse

G01 Linear Interpolation (Feed)

G02 Circular Interpolation (Clockwise)

G03 Circular Interpolation (Anti-clockwise)

G04 Dwell

G20 Inch data input

G21 Metric data input (mm)

G28 Reference point return

G32 Thread cuttingG40 Tool nose radius compensation cancel

Page 11: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 11/40

G41 Tool nose radius compensation-left

G42 Tool nose radius compensation-right

G50 Maximum spindle speed setting

G70 Finishing cycle

G71 Stock removal in turning (Multiple turning)G72 Stock removal in facing (Multiple facing)

G73 Pattern repeating

G74 Peck drilling in Z-axis

G75 Multiple grooving in X-axis

G76 Multiple thread cutting cycle

G81 Grooving along X-axis

G90 Cutting cycle (Box turning cycle)

G92 Thread cutting cycle

G94 Cutting cycle (Box facing cycle)

G96 Constant surface speed control

G97 Constant surface speed control cancel

G98 Feed per minute

G99 Feed per revolution

Miscellaneous Function Codes (M-Codes): The miscellaneous functions are popularly known as M-

codes. The M-codes operate some controls on the machine tool and this affect the running of the

machine. A complete list of M-codes is tabulated below:

M-Code Function

M00 Program Stop

M01 Optional Stop

M02 Program End

M03 Spindle rotation (CW)

M04 Spindle rotation (CCW)

M05 Spindle Stop

M06 Tool Change

M08 Coolant On

M09 Coolant Off 

M10 Vice OpenM11 Vice Close

M98 Sub Program Call

M99 Sub Program Exit

M30 Program Stop and Rewind

M70 X-axis Mirror On

M71 Y-axis Mirror On

M80 X-axis Mirror Off 

M81 Y-axis Mirror Off 

Page 12: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 12/40

CNC Turning Centre Programming:

Introduction: - In CNC turning centre’s, the axes system followed is basically X and Z. Generally,

single point cutting tools such as turning tools or boring tools are used. These tools are normally

carried on tool turret and the tool change is effected by turret indexing.

Axis Convention for Turning:For turning, there are two axes only namely Z-axis and X-axis. The Z-axis lies along the axis

of spindle rotation. The positive Z (+Z) is the direction away from the work spindle.

The X-axis is perpendicular to the Z-axis and the positive X (+X) is the direction towards the

operator and vice versa.

Description of Important G-Codes:

G00 - Linear Interpolation: This word makes the tool to move to the target point at a specified feed

rate as given in the same Block. Speed of spindle is also specified in the same Block.

Ex: G01 X40 Z-20 F30 S1200

G02 - Circular Interpolation (CW): This word makes the tool to move in circular arc in clockwisedirection.

Ex: G02 X40 Z-25 R5 F25

G03 - Circular Interpolation (CCW): This word also makes the tool to move in circular arc, but in

anti-clockwise direction.

Ex: G03 X40 Z-25 R5 F25

G20 - Inch Data Input: This word specifies that the programming has been done in the unit of inch.

This has to be specified at the start of the program itself.

G21 - Metric Data Input: This word specifies that the programming has been done in the unit of 

millimeters (mm). This has to be specified at the start of the program itself.

G28 - Reference Point Return: This word causes the fast traverse of the tool to the specified

position and then to the machine datum (home position).

Ex: G28 X30 Z5

G28 U0 W0

Cutter Radius Compensation: In case of a turning a work profile using a pointed edge cutting tool, the

path of the tool will be exactly on the work profile that is there is no offset between the tool path and

the work profile. Hence no cutter compensation is required.

But when machining is carried out using a round nose tool, then the actual path of tool will be the

center point of tool nose radius. That is the path of tool is offset from the work profile by an amount

equal to the radius of tool nose. Hence it is very difficult to program the tool path especially for the

curved work profile and other such complicated work profiles. In order to avoid such difficulties in

programming, suitable compensation equal to the radius of tool nose is entered and stored in the

control system. By providing such compensation, programming can be easily done only for the actual

work profile as if the tool nose radius is zero.

The codes used for such radius compensation are G40, G41, G42.

G40 - Tool nose radius compensation-Cancel: This word cancels the tool nose radius

compensation codes G41 and G42 already inputted.

G41 -Tool nose radius compensation-Left: This word is used when the tool is on the left side of the

programmed path, when looking in the direction of tool movement.

Page 13: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 13/40

G42 - Tool nose radius compensation-Right: This word is used when the tool is on the right side of 

the programmed path, when looking in the direction of tool movement.

Box Turning and Box Facing Cycles (G90 & G94):

While machining a component in CNC-Lathe, each cut in turning requires the following four distinct

moves of the tool like, (fig. 6)

-  Rapid X position (1)

-  Feed to Z position (2)

-  Retrieve to start X position (3)

-  Retrieve to start Z position (4)

And each cut in facing requires the following 4-moves of the tool like, (fig. 7)

-  Rapid Z position (1)

-  Feed to X position (2)

-  Retrieve to start Z position (3)

-  Retrieve to start X position (4)

Therefore, when the program involves number of toughing cuts, then the length of the program will

be extremely long. In such cases, Box turning cycle and Box facing cycle become very useful to

reduce the length of the program.

G90 - Box Turning Cycle (Canned Cycle): This word performs four distinct moves, just with one

Block of information. It is a canned cycle in which metal removal takes place when the tool moves

along Z-axis.

Ex: G90 X30 Z-20 F30

X28

X26

G94 - Box Facing Cycle: This word also performs four distinct moves, just with one Block of information. It is also a canned cycle in which the metal removal takes place parallel to the X-axis.

Ex: G94 X20 Z-1 F30

Z-2

Z-3

G71 - Multiple turning cycles: This word causes the profile of the component to be rough turned

by number of tool passes along the Z-axis, leaving a small amount of material, which is to be removed

using finishing cycle G70. It is a 2-Block command, more advantageous than Box turning cycle.

The syntax is:

N1 G71 U(n1) R(n2)

N2 G71 P(n3) Q(n4) U(n5) W(n6) F(n7) s(n8)

Where n1 - depth of cut for each tool pass in X-axis

n2 - relief amount

n3 - Block number at which profile machining starts

n4 - Block number at which profile machining ends

n5 - Finishing allowance in X-axis

n6 - Finishing allowance in Z-axis

n7 - Speed

n8 - Block numbers

Page 14: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 14/40

Ex: N30 G71 U1 R2

N40 G71 P50 Q100 U0.1 W0.1 F30 S1200

N50 - - - - -

- - - - - - -

N100 - - - -N110 G70 P50 Q100 F20 - Finishing Cycle

G72 - Multiple facing cycle: This word causes the profile of the component to be rough faced by

number of tool passes along X-axis, leaving a small amount of material to be removed using finishing

cycle G70. It is also a 2-Block command, more advantageous than Box facing cycle.

The syntax is

N1 G72 W(n1) R(n2) n1 – Depth of cut in Z-axis

N2 G72 P(n3) Q(n4) U(n5) W(n6) F(n7) S(n8) n6 – Finishing allowance in Z-axis

Ex: N50 G72 W1 R2

N55 G72 P60 Q90 U0.1 W0.1 F40 S1200

N60 - - - -

- - - - - - -

N90 - - - -

N95 G70 P60 Q90 F25 - Finishing Cycle

G70 - Finishing Cycle: As seen earlier in G71 & G72 roughing cycles, some amount of material is

left as the finishing allowance. This material is removed by using this finishing cycle G70. The tool

path is same as that of the path followed in roughing G71 & G72 codes.

Syntax: N G70 P(n1) Q(n2) F(n3)

Ex: N90 G70 P60 Q100 F25

G74 - Peck drilling along Z-axis: Usually, the deep hole drilling is not performed in a single pass.

Instead it is performed in multiple passes. That is the drill advances into the work by a set of pre-

determined amount. This is to facilitate the chip breaking and removal. This is also a 2-Block 

command.

The syntax is

G74 R(n1)

G74 X(n2) Z(n3) Q(n4) R(n5) F(n6)

Where n1 - tool return after each pass

n2 - position of X-co-ordinate = 0

n3 - total depth (absolute)

n4 - depth of cut for each pass in Microns

n5 - relief amount at the bottom of hole (here it is zero)

n6 - feed rate

Ex: G74 R1.0

G74 Z-30 Q500 R0 F20

G75 - Grooving (multiple cycles): This word makes the grooving tool to machine a groove on the

work piece by moving along X-axis and Z-axis in multiple passes. This is a 2-Block command.

Page 15: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 15/40

The syntax is

G75 R(n1)

G75 X(n2) W(n3) P(n4) Q(n5) F(n6)

Where n1 - tool return after each pass

n2 - total depth of groove along X-axisn3 - width of groove along Z-axis

n4 - step increment along Z-axis in Microns

n5 - peck increment along X-axis in Microns

n6 - feed rate

Ex: G75 R1

G75 X6 W-5 P1500 Q250 F15

G81 - Grooving: This word performs grooving operation, by moving the tool in steps along X-axis

only.

Ex: G00 X16 Z-20

G81 X15.5 F30

X15

X14.5

X14

X13.5

Threading Cycle (G92 & G76)

G92 - Box type threading cycle: This word completes one threading cycle at a specified diameter.

In order to complete the full thread cutting, threading tool has to complete number of such cycles at

different depth of cut as specified.

The syntax is

G92 X(n1) Z(n2) F(n3)

Where n1 - successive core diameter

n2 - Length of thread

n3 - Pitch of thread

Ex: G00 X12 Z2

G92 X11.5 Z-23 F1.25

X11.0G76 -Multiple threading cycles: This word causes the complete profile of thread to be formed in

multiple passes of the tool.

The syntax is

G76 P(n1) (n2) (n3) Q(n4) R(n5)

G76 X(n6) Z(n7) P(n8) Q(n9) F(n10)

Where n1 - number of finishing cut

n2 - thread chamfer angle

n3 -tool tip angle or thread angle

n4 - minimum cutting depth is Microns

Page 16: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 16/40

n5 - finishing allowance

n6 - core diameter of thread

n7 - length of thread

n8 - height of thread in Microns

n9 - depth of first cut in Micronsn10 - pith or lead of thread

Thread Parameters

Nominal diameter Pitch (F) Core Diameter (X) Thread height

in   in mm Bolt Nut in mm

M2.5 0.45 1.948 2.013 0.276

M3 0.5 2.387 2.459 0.307

M4 07 3.141 3.242 0429

M6 1 4.773 4.918 0.613

M8 1.25 6.466 6.649 0.767

M10 1.5 8.160 8.376 0.920

M12 1.75 9.853 10.106 1.074

M16 2 13.546 13.835 1.227

M20 2.5 16.933 17.294 1.534

M24 3 20.32 20.752 1.840

M30 3.5 25.706 26.211 2.147

M36 4 31.93 31.67 2.454

G90 - Taper turning cycle: This word perform Box type taper turning.The syntax is

G90 X Z R F

Where X - terminal diameter of tool movement

Z - Length of taper

R -

D1 is initial diameter

D2 is final diameter

F - Feed

Ex: G00 X20 Z-20G90 X20 Z-25 R0 F30

X20 R-0.5

X20 R-1

Description of some M-Codes:

M00 - Program Stop: This word causes the execution of the program to be stopped and the cutting

cycle is also stopped after the Block containing M00, to enable the inspection check.

M01 - Optional Stop: This word also causes the cycle operation to be stopped, after the block 

containing M01. This code is effective only when the optional switch on the machine control panel

has been pressed.

Page 17: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 17/40

M02 - Program End: This word is inserted at the end of the program to bring the cycle to end. To

start another cycle, the system must be reset.

M03 - Spindle Rotation (CW): This word causes the spindle to rotate in the clockwise direction at

the specified speed.

M04 - Spindle Rotation (CCW): This word causes the spindle to rotate in counter clockwise

direction at the specified speed.

M05 - Spindle Stop: This word causes the spindle to stop, without changing the spindle speed.

M06 - Tool Change: This is the code meant for the Tool change. This code is always followed by

“T” word. The T-word is also followed by a 4-digit number. The first 2-digit refers to the new tool

number and the next 2-digit refers to the tool offset registry. Normally tool change is effected by

bringing the tool post to the reference point using the code G28.

M30 - Program Stop and Rewind: This word normally appears at the end of the program and brings

everything to “OFF”. 

M98 -Sub-routine Call: This word causes the sub-routine to be invoked into a main program.

The syntax is M98 P003 1005

M99 - Sub-routine exit: This word causes the sub-routine part of the program to Terminate and the

control is immediately transferred to the statement following “M98”. 

Mirroring (M70, M71, M80, M81): For obtaining the image of a profile, which is symmetrical about

an axis is called Mirroring or Reflection. Mirroring can be done about X-axis, Y-axis or Z-axis.

Mirroring is one of the advanced programming ability available in almost all the controllers.

Mirroring an image is taken care of by the following M-codes:

M70 - X mirror ON

M71 – Y mirror ON

M80 – X mirror OFF

M81 – Y mirror OFF

CNC Milling Programming:

Introduction:

In CNC milling, the axis system followed is basically X, Y and Z. it usually makes use of Multipoint

Cutting Tools. The tool is normally carried on rotating spindle and the tool change from the tool

magazine is effected by using ATC.

Axis convention for CNC Milling:

The sing convention for 3-axis namely X, Y and Z for milling machines can be found out using

“Right hand rule”. 

“Hold the thump, fore finger and middle finger right hand mutually perpendicular to each other. Keep

the middle finger along the spindle axis, which is the Z-axis. Then the positive Z (+Z) is the direction

away from the work piece and vice-versa.

The direction of thump represents the positive X (+X), which is the longest travel of the work slide.

The direction of fore finger represents the positive Y (+Y).

The base of these three fingers is taken as origin (X0, Y0, Z0).

G-codes for milling: Some of the G-Codes for milling are same as that of turning. That is these codes

have the same meaning for both Turning and Milling. The different G-codes for milling are given

below:

Page 18: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 18/40

G-Codes for Milling:

G-Codes Function

G00 Rapid traverse

G01 Linear interpolation

G02 Circular interpolation (CW)G03 Circular interpolation (CCW)

G04 Dwell

G17 XY plane selection

G18 XZ plane selection

G19 YZ plane selection

G20 Inch data input

G21 Metric data input

G28 Reference point return

G40 Cutter compensation cancel

G41 Cutter compensation left

G42 Cutter compensation right

G43 Tool length compensation + direction

G44 Tool length compensation – direction

G49 Tool length compensation cancel

G73 Peck drilling cycle – High speed

G74 Counter tapping cycle

G76 Fine boring

G80 Canned cycle cancel

G81 Drilling cycle, spot boring cycle

G82 Drilling cycle, counter boring cycle

G83 Peck drilling cycle

G87 Back boring cycle

G88 Boring cycle

G89 Boring cycle

G90 Absolute command

G91 Incremental command

G92 Programming of absolute zero point

G94 Feed per minute

G95 Feed per revolution

G98 Return to initial point in canned cycle

G99 Return to R-point in canned cycle

Page 19: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 19/40

M-Codes for Milling:

M-Codes Functions

M00 Program stop

M01 Optional stop

M02 Program endM03 Spindle forward

M04 Spindle reverse

M05 Spindle stop

M06 Tool change function

M08 Coolant On

M09 Coolant Off 

M10 Vice open

M11 Vice close

M13 Coolant, spindle forward

M14 Coolant, spindle reverse

M30 Program stop and rewind

M70 X-Mirror On

M71 Y-Mirror On

M80 Z-Mirror OFF

M81 X-Mirror Off 

M98 Sub program call

M99 Sub program exit

Description of Some G-Codes:

G73 & G83 - Peck drilling Cycle: This word causes the hole to be drilled along Z-axis in multiple

passes of the tool.

The syntax is

G83 X(n1) Y(n2) Z(n3) P(n4) Q(n5) R(n6) F(n7)

Where n1 - X-co-ordinate of the hold to drill at hole

n2 - Y-co-ordinate of the hold to drill at hole

n3 - depth of the hole to be drilled

n4 - dwell time (in Microns)n5 - depth of the cut for each peak drill (always +ve)

n6 - Z-co-ordinate for “R” point 

n7 - feed in mm/min

Ex: G83 G99 X0 Y20 Z-8 P500 Q/05 R1 F50

X10 Y20

G80 - - - - -

Boring Cycle (G70, G85, G86, G87, G88, G89): Enlarging the diameter of a hole, which is already

drilled is known as boring. There are different G-codes employed for boring or counter boring.

The syntax is

G86 X(n1) Y(n2) Z(n3) P(n4) Q(n5) R(n6) F(n7)

Page 20: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 20/40

Where n1 - X-co-ordinate of hole position to bore at

n2 - Y-co-ordinate of hole position to bore at

n3 - depth of bore

n4 - dwell time

n5 - depth of cut for each peck n6 - Z-co-ordinate of “R” point 

n7 - feed rate in mm/min

Mirroring (M70, M71, M80, and M81): Getting the image of a profile, which is symmetrical about an

axis, is called mirroring or reflection. Mirroring can be done about X, Y and Z axes.

Mirroring is one of the advanced programming ability available in almost all controller.

Page 21: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 21/40

Guide lines to Run Lathe Programs:

1.  First enter the program.

2.  After entering the program, move the cursor to program number using page up key or

upward arrow key.

3.  Press F9. You will get the simulation display.4.  Using the up-down arrow keys, select the CHECK SYNTAX and press Enter key.

“Your CNC Program is OK” should be displayed otherwise press Esc. The cursor will

be on the line number in which there may be a syntax error. Correct the error and

follow the steps 2, 3 and 4 till the message, “Your CNC Program is OK” is displayed. 

SIMULATION

Check Syntax

Run Program

Dry RunSet Tooling

Set View

3D View

Post Process

5.  Press F9 and select “Set Tooling” and press Enter; you will get the tool list. Use the

arrow keys and select the tool number mentioned in the program and press Enter. The

tool will be displayed. Using left-right arrow keys, select the suitable tool and press

Enter and press Ecs.

Tool 00Tool 01

Tool 02

----------

----------

6.  Press F9 and select “Run Program” and press Enter. The simulation will start.  

7.  If there is any message during simulation, press Esc the cursor will be in the line

where there may be any syntax error. Correct the error and follow the same procedure.

8.  To save the program, press F10 wherein the following is displayed.

9.  Select “CNC Files”, press Enter. 

Page 22: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 22/40

10. Select “Save as”, press Enter. 

11. Enter file name, press Enter. The program is saved.

12. To enter next program; select “New”, press Enter and press Esc.  

13. To load a program, already saved, select “Load” and press Enter.

14. Enter file name and press Enter.

Guide lines to Run Milling Programs:

1.  First enter the program.

2.  After entering the program, move the cursor to program number using page up key or

upward arrow key.

3.  Press F9. You will get the simulation display.

4.  Using the up-down arrow keys, select the CHECK SYNTAX and press Enter key.

“Your CNC Program is OK” should be displayed otherwise press Esc. The cursor will

be on the line number in which there may be a syntax error. Correct the error and

follow the steps 2, 3 and 4 till the message, “Your CNC Program is OK” is displayed. SIMULATION

Check Syntax

Run Program

Dry Run

Set Tooling

Set View

3D View

Post Process

5.  Press F9, select “Set datum”. 

a.  If you have defined edge move as X0 Y0, using arrow keys move the X-axis

cursor to ‘0’. It will be displayed on the bottom of the screen. Similarly move

the Y-axis cursor to ‘0’. After setting the cursor, press Enter. 

b.  If you define edge move as X-50, Y-50, using the arrow keys move the X-axis

cursor to half of the X-axis maximum travel and Y-axis cursor to half of the

Y-axis maximum travel and then press Enter.

6.  Select “Run Program” and press Enter. 

7.  If there is any message during simulation press Esc, the cursor will be in the line

number in which there may be an error. Correct the error and follow the sameprocedure.

Page 23: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 23/40

Exercise-1 PROGRAM FOR SIMPLE TURNING USING G01 CODE

  Reducing Diameter from 32 mm to 22 mm:

PLANNING AND OPERATION SHEET

BILLET SIZE : ø 32, L = 70 MATERIAL : Aluminum

Program number : 1001 Drawing number :16

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1. TurningTurning

tool 01 01 1200 30

O 1001 Program number

(BILLET X32 Z70) Defining work piece size; Ø 32mm, Length 70 mm

G21 All measurements are in ‘mm’ 

G98 Feed in mm/min

G40 Cutter Radius compensation cancels

G28 U0 W0 Tool to home position

M06 T0101 Selection tool no: 1 and its offset no: 1M03 S1200 Start and rotate spindle at 1500rpm CW

G00 X32 Z1 Initial positioning the tool

G01 X30 Z1 F30 Giving 1mm depth of cut

G01 X30 Z-50 Turning ø 30mm up to 50mm length

G00 X32 Z-50 Withdrawing tool

G00 X32 Z1 Bringing the tool to give second cut

G01 X28 Z1 Giving 1mm depth of cut

G01 X28 Z-50 Turning ø 28mm up to 50mm length

G00 X30 Z-50 withdrawing the tool

G00 X30 Z1 Bringing the tool to give third cut

G01 X26 Z1 Giving 1mm depth of cut

G01 X26 Z-50 Turning ø 26mm up to 50mm length

G00 X28 Z-50 withdrawing the tool

G00 X28 Z1 Bringing the tool to give fourth cut

G01 X24 Z1 Giving 1mm depth of cut

G01 X24 Z-50 Turning ø 24mm up to 50mm length

G00 X26 Z-50 withdrawing the toolG00 X26 Z1 Bringing the tool to give fifth cut

Page 24: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 24/40

G00 X22 Z1 Giving 1mm depth of cut

G01 X22 Z-50 Turning ø 22mm up to 50mm length

G28 U0 W0 Tool to home position

M05 Stop the spindle

M30 Program end and rewind

Page 25: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 25/40

Exercise-2 PROGRAM FOR STEP TURNING USING G90 CODE

  Step Turning from ø 34 mm to ø 28mm, ø 16mm and ø 10mm in sequence:

PLANNING AND OPERATION SHEETBILLET SIZE : ø 34, L = 60 MATERIAL : Aluminum

Program number : 1003 Drawing number :19

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1. TurningTurning

tool01 01 1200 30

O 1003

(BILLET X34 Z60)

G21 G98 G40

G28 U0 W0

M06 T0101

M03 S1200

G00 X34 Z1

G90 X34 Z-40 F30

X33

X32

X31X30

X29

X28

X28

M01 Optional Stop, press Enter to run the program

X27 Z-22

X26

X25

X24

Page 26: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 26/40

X23

X22

X21

X20

X19X18

X17

X16

M01 Optional Stop, press Enter to run the program

X15 Z-10

X14

X13

X12

X11

X10

M01 Optional Stop, press Enter to run the program

G28 U0 W0

M05

M30

Page 27: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 27/40

Exercise-3 PROGRAM FOR TAPER TURNING USING G90 CODE (R -)

  Taper turning from ø 30mm to ø 20 mm:

PLANNING AND OPERATION SHEET

BILLET SIZE : ø 30, L = 40 mm MATERIAL : Aluminum

Program number : 1004 Drawing number :20

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1.Taper

Turning

TaperTurning

tool01 01 1200 30

O 1004

(BILLET X30 Z40)

G21 G98 G40

G28 U0 W0

M06 T0101

M03 S1200

G00 X30 Z1

G01 X30 Z0 F30

G90 X30 Z-15 R0 F30 Calling taper turning canned cycle; 1st cut

X30 Z-15 R-1 F30 2nd cut (ø 28)

X30 Z-15 R-2 F30 3rd cut (ø 26)

X30 Z-15 R-3 F30 4th cut (ø 24)

X30 Z-15 R-4 F30 5th cut (ø 22)

X30 Z-15 R-5 F30 6th cut (ø 20)

M01

G28 U0 W0

M05

M30 Formulae:

Negative

Page 28: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 28/40

Exercise-4 PROGRAM FOR MULTIPLE TURNING USING

G71 & G70 CODES

  Reducing diameter in steps: 

Position X Z

1 0 0

2 12 -6

3 12 -16

4 20 -24

5 20 -36

6 30 -507 30 -62

8 38 -70

PLANNING AND OPERATION SHEET

BILLET SIZE : ø 38, L = 90 mm MATERIAL : Aluminum

Program number : 1007 Drawing number :23

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1. MultipleTurning Turningtool 01 01 1200 30

O1007

(BILLET X38 Z90)

G21 G98 G40

M06 T0101

M03 S1200

G00 X38 Z1

G71 U0.5 R1G71 P10 Q20 U0.5 W0 F30

Page 29: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 29/40

N10 G01 X0

Z0

G03 X12 Z-6 R6

G01 X12 Z-16

G02 X20 Z-24 R6G01 X20 Z-36

G01 X30 Z-50

G01 X30 Z-62

N20 G03 X38 Z-70 R6

G70 P10 Q20

M01

G28 U0 W0

M05

M30

Page 30: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 30/40

Exercise-5 PROGRAM FOR DRILLING AND BORING USING

G74 & G90 CODES

  Drilling and then boring the hole to ø 10mm :

PLANNING AND OPERATION SHEET

BILLET SIZE : ø 60, L = 70 mm MATERIAL : Aluminum

Program number : 1009 Drawing number :25

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1. Drilling

Drill Bit,

ø12 mmsize

02 02 1200 30

2. BoringBoring tool,

ø10 mmsize

03 03 1200 30

O1009

(BILLET X60 Z70)

G21 G98

G28 U0 W0

M06 T0202

M03 S1200

G00 X0 Z1

M08

G74 R1

G74 Z-37 Q1000 F30

G28 U0 W0

M06 T0303

G00 X0 Z1G00 X12 Z1

Page 31: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 31/40

G90 X12 Z1

X12 Z-37

X13

X14

X15X16

M01

X17 Z-27

X18

X19

X20

X21

X22

M01

X23 Z-15

X24

X25

X26

X27

X28

X29

X30

X31

X32

M09

M01

G28 U0 W0

M05

M30

Page 32: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 32/40

Exercise-6 PROGRAM FOR GROOVING USING G75 CODE

  Grooving on the Outer surface of the given billet:

PLANNING AND OPERATION SHEET

BILLET SIZE : ø 32, L = 70 mm MATERIAL : Aluminum

Program number : 1010 Drawing number :26

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1. GroovingGroovingtool 2mm

width04 04 1000 30

O 1010

(BILLET X32 Z70)G21 G98

M06 T0404 Grooving tool

M03 S1000

G00 X35 Z-32 Positioning grooving tool

M01

G75 R1 Calling grooving cycle, tool retract 1mm

G75 X20 W-10 P1000 Q1000 F30 Grooving up to ø 20 mm for 12mm length

M01

G28 U0 W0

M05

M30

*P1000 - at end of each cut the tool has to move 1000µ in Z-axis

*Q1000 - depth of cut is 1000 µ 

Page 33: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 33/40

Exercise-7 PROGRAM FOR THREAD CUTTING USING G92 CODE

  Thread Cutting to ø 9.853 mm:

PLANNING AND OPERATION SHEETBILLET SIZE : ø 20, L = 70 mm MATERIAL : Aluminum

Program number : 1011 Drawing number :27

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1. TurningTurning

tool01 01 1200 30

2.Threadcutting

Threadcutting tool

05 05 150 -

O 1011(BILLETS X20 Z70)

G21 G98

G28 U0 W0

M06 T0101

M03 S1200

G00 X20 Z1

G90 X20 Z-45 F30

X19

X18

X17

X16

X15

X14

X13

X12

M01

G28 U0 W0M06 T0505

S.No CoreDiameter

ThreadHeight

Pitch

M8 6.466 0.767 1

M10 8.16 0.920 1.25

M12 9.853 1.074 1.25

M16 13.546 1.227 1.5

M20 16.933 1.534 1.5

Page 34: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 34/40

G97

M03 S150

G00 X12 Z0

G01 X12 Z0

G92 X12 Z-30 F1.25X11

X9.853 (Core diameter is 9.853)

M01

G28 U0 W0

M05

M30

Page 35: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 35/40

Exercise-8 PROGRAM FOR MILLING USING G01, G02, G03 CODES

  Milling as per given diagram:

PLANNING AND OPERATION SHEET

BILLET SIZE : X=100mm, Y=100mm,Z=10mm(thickness)

MATERIAL : Aluminum

Program number : 1013 Drawing number :28

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1. Countouring Slot cutter 5 1 1500 30

O 1013

(BILLET X100 Y100 Z10) Billet size

(TOOLDEF T1 D5) Tool number and diameter

(EDGEMOVE X0 Y0) Defining 0.0 point on work 

G21

G94 Feed in mm/min

G40

G91 Incremental dimensioning

G28 X0 Y0

G90 Absolute dimensioning

M06 T1 Calling Tool no:1

M03 S1500 Start and rotate spindle at 1500rpm CW

G00 X30 Y15 Z5 Initial positioning of tool above position 1

G01 X30 Y15 Z-1 F30 Giving depth of cut of 1mm

G01 X70 Y15 Moving tool to no:2 position

G03 X80 Y25 R10 Moving tool to no:3 position; radius = 10mm

G01 X80 Y75 Moving tool to no:4 positionG02 X70 Y85 R10 Moving tool to no:5 position; radius= 10mm

Page 36: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 36/40

G01 X30 Y85 Moving tool to no:6 position

G03 X20 Y75 R10 Moving tool to no:7 position; radius= 10mm

G01 X20 Y25 Moving tool to no:8 position

G02 X30 Y15 R10 Moving tool to no:1 position; radius= 10mm

G00 Z5 Withdrawing toolG00 X35 Y50 Moving tool to no:9 position

G01 Z-1 Giving 1mm depth of cut

G02 X65 Y50 R15 Moving tool to no:10 position; radius= 15mm

G02 X35 Y50 R15 Moving tool to no:9 position; radius= 15mm

G91 Incremental dimension

G28 X0 Y0 Tool to home position

M05

M30

Page 37: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 37/40

Exercise-9 PROGRAM FOR PECK DRILLING CYCLE USING

G83 CODE

  Milling as per given diagram:

PLANNING AND OPERATION SHEET

BILLET SIZE : X=100mm, Y=100mm,Z=10mm(thickness)

MATERIAL : Aluminum

Program number : 1014 Drawing number :29

S. No. Operation Tool typeTool station

no

Tool offset

no

Spindle

speed, RPM

Feed

mm/min1. Drilling Drill bit 10 1 1500 30

2. Drilling Drill bit 6 2 1500 30

O 1014

(BILLET X100 Y100 Z10)

(TOOLDEF T1 D10) Defining 1st tool

(TOOLDEF T2 D6) Defining 2nd tool

(EDGEMOVE X0 Y0)

G21 G94 G40 G91

G28 X0 Y0

G90

M06 T1

M03 S1500

G00 X20 Y25 Z5 Position above 1st hole

G99 Return to reference point

G83 X20 Y25 Z-5 P1000 Q0.5 R0.5 F30 K1 Calling peck drill cycle and drilling hole:1

X80 Y25 Drilling hole no:3

X20 Y75 Drilling hole no:7

Page 38: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 38/40

X80 Y75 Drilling hole no:9

G91

G28 X0 Y0 G90

M06 T2 Changing tool no:2

G00 X20 Y50 Z5 Positioning above hole no: 4G99

G83 X20 Y50 Z-5 P1000 Q0.5 R0.5 F30 K1 Drilling hole no: 4

X50 Y25 Drilling hole no: 2

X50 Y50 Drilling hole no: 5

X80 Y50 Drilling hole no: 6

X50 Y75 Drilling hole no: 8

G91

G28 X0 Y0

M05

M30

Page 39: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 39/40

Exercise-10 PROGRAM FOR COUNTOURING THROUGH SUB-

PROGRAM AND MIRRORING

  Countouring through Subprogram and Mirroring:

PLANNING AND OPERATION SHEET

BILLET SIZE : X=100mm, Y=100mm,Z=10mm(thickness)

MATERIAL : Aluminum

Program number : 1015 Drawing number :30

S. No. Operation Tool typeTool station

noTool offset

noSpindle

speed, RPMFeed

mm/min

1. Countouring Slot cutter 5 1 1500 30

Main Program

O 1015

(BILLET X100 Y100 Z10)

(TOOLDEF T1 D5)

(EDGEMOVE X-50 Y-50)

G21 G94 G40 G91

G28 X0 Y0

G90

M06 T1

M03 S1500

G00 X0 Y0 Z5 Position tool 5mm above X0, Y0

G98 P0011234 Calling sub-program 1234 (Q1)

M70 X-axis mirror On (Q2, all X taken as – X)

M98 P0011234 Calling sub-program 1234 (Q2)

M80 X-axis mirror Off 

M71 Y-axis mirror On (Q4, all Y taken as – Y)M98 P0011234 Calling sub-program 1234

Page 40: ME0423

7/31/2019 ME0423

http://slidepdf.com/reader/full/me0423 40/40

M81 Y-axis mirror Off 

M70 X-axis mirror On

M71 Y-axis mirror On

M98 P0011234 Calling sub-program (Q3)

M80 X-axis mirror Off M81 Y-axis mirror Off 

G91

G28 X0 Y0

M05

M30

Sub Program

O 1234

G00 X15 Y15

G01 X15 Y15 Z-1 F30

G01 X35 Y15

G03 X15 Y35 R20

G01 X15 Y15

G00 X15 Y15 Z5

G00 X0 Y0

M99 Exit from Sub-program