CNC Basic

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 80

DIRECT NUMERICAL

CONTROL

Dept. of Aero & Auto Engg, M.I.T 1


Dept. of Aero & Auto Engg, M.I.T 2
DIRECT NUMERICAL CONTROL

A manufacturing system in which a number of machines are controlled

by a computer through direct connection in real time.

It consists of,
1. Central computer
2. Memory
3. Telecommunication lines
4. Machine tools

Dept. of Aero & Auto Engg, M.I.T 3


Direct Numerical Control

Central Bulk memory


computer NC program

Telecommunication
lines

Machine
tools

Figure : DNC system

Dept. of Aero & Auto Engg, M.I.T 4


Direct Numerical Control (DNC)
Advantages:
1. Time sharing

– Control of more than one machine by the computer

2. Greater computational capability

3. Remote computer location

4. Improved reliability

5. Programs stored as cutter location data

Dept. of Aero & Auto Engg, M.I.T 5


DNC CNC
1. Controls many machines 1. Controls only one machine

2. Occupy remote locations 2. Located near the machine tools

3. Acts as a many tool 3. For one machine tool

Dept. of Aero & Auto Engg, M.I.T 6


ISO MACHINE TOOL AXIS DEFINITION

Dept. of Aero & Auto Engg, M.I.T 7


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

Dept. of Aero & Auto Engg, M.I.T 8


NC Coordinate Systems
➢ To program the NC processing equipment, a standard axis system must be
defined by which the position of the work head relative to the work part can be
specified.

➢ There are two axis systems used in NC, one for flat and prismatic parts and the
other for rotational parts.

➢ Both axis systems are based on the Cartesian Coordinate System.

Dept. of Aero & Auto Engg, M.I.T 9


Dept. of Aero & Auto Engg, M.I.T 10
NC Coordinate Systems

The axis system for flat and prismatic parts consists of:
1. Three linear axes (X, Y, Z) in Cartesian coordinate system.
2. Three rotational axes (A, B, C)

In most machine tool applications, the x-axes and y-axes are used to move and position the
worktable to which the part is attached, and the z-axis is used to control the vertical position
of the cutting tool 11
Dept. of Aero & Auto Engg, M.I.T 12
RIGHT HAND RULE
Vertical Machine & Horizontal Machine

Dept. of Aero & Auto Engg, M.I.T 13


Dept. of Aero & Auto Engg, M.I.T 14
Example of CNC Programming

What Must Be Done To Drill A Hole On A


CNC Vertical Milling Machine

Dept. of Aero & Auto Engg, M.I.T 15


Tool At Home

Top
View

Front
View

Dept. of Aero & Auto Engg, M.I.T 16


Top
View

Front
View

Dept. of Aero & Auto Engg, M.I.T 17


Top
View

Front
View

Dept. of Aero & Auto Engg, M.I.T 18


Top
View

Front
View

Dept. of Aero & Auto Engg, M.I.T 19


Top
View

Front
View

Dept. of Aero & Auto Engg, M.I.T 20


LETTER ADDRESS LISTING
Letter addresses are variables used in G- and M-codes. Most G-codes contain a variable,
defined by the programmer, for each specific function. Each letter used in CNC
programming is called an address, or word. The words used for programming are as follows.
F Assigns a feed-rate
G Preparatory function
I X-axis location of ARC center
K Z-axis location of ARC center
M Miscellaneous function
N Block number (specifies the start of a block)
P Start block
D Dwell time
Q Block end
D Depth
R Radius
S Sets the spindle speed
T Specifies the tool to be used
A Tool angle
U X stock or incremental value
W Z stock or incremental value
X X coordinate
Z Z coordinate
Dept. of Aero & Auto Engg, M.I.T 21
NC Words
N, G, X, Y , Z, A, B, C, I, J, K, F, S, T, R, M

➢ F: feed rate of the tool motion


➢ S: cutting-speed
➢ T: tool number

Dept. of Aero & Auto Engg, M.I.T 22


NC Words
N, G, X, Y , Z, A, B, C, I, J, K, F, S, T, R, M

➢ X, Y, Z, A, B, C: provide the coordinate positions of the


tool. X, Y, and Z define the three translational (Cartesian)
axes of a machine. A, B and C are used for the three
rotational axes about the X, Y, and Z axes.
➢ I, J, K: specify the center for circular motion

Dept. of Aero & Auto Engg, M.I.T 23


G-codes
G 00: Rapid traverse
G 01:Inear interpolation
G 02:Circluar interpolation(clockwise)
G 03:Circular interpolation(counter-clockwise)
G 04:Dwell cycle
G 20:Data is in inches
G 21:Metric data input
G 28:Return to reference point

Dept. of Aero & Auto Engg, M.I.T 24


Dept. of Aero & Auto Engg, M.I.T 25
G01 LINEAR INTERPOLATION
Format: N_ G01 X_ Z_ F_
The G01 command executes all movement along a straight
line at a particular feedrate. These straight-line feed moves
may cut in one or two axes simultaneously. This command can
be used for turning, facing, and tapering. It is specified by the
G01 command, followed by the endpoint of the move, and
then a specified feedrate.

Dept. of Aero & Auto Engg, M.I.T 26


EXAMPLE: G01 Z-2.5 F0.01
In this example, the tool cuts a straight line from its present
location to a point at Z–2.5 at a rate of 0.01

Dept. of Aero & Auto Engg, M.I.T 27


G03 CIRCULAR INTERPOLATION (CCW)
Format: N_ G03 X_ Z_ I_ K_ F_
or N_ G03 X_ Z_ R_ F_
The G03 command executes all radial cuts in a counterclockwise motion. It is specified
by the G03 command, followed by the endpoint for the move, the radius (the distance
from the start point to the center point), and a feedrate.
The radius is specified by defining the incremental distance from the arc’s start-point to
its center-point in both the X and Z directions. These values are identified by I and K
variables, respectively. The R word, the value of the radius of the arc, can also be used.

Dept. of Aero & Auto Engg, M.I.T 28


29
G20 Inch Units
Format: N_ G20

G21 Metric or SI Units


Format: N_ G2

Dept. of Aero & Auto Engg, M.I.T 30


G90 Absolute Positioning
Format: N_ G90
The G90 command defaults the system to accept all coordinates as
absolute coordinates. These coordinates are measured from a fixed
origin (X0, Y0, Z0) and expressed in terms of X, Y, and Z
distances.

G91 Incremental Positioning


Format: N_ G91
Incremental coordinates are measured from the previous
point and are expressed in terms of the relative X and Z
distances from the previous point

Dept. of Aero & Auto Engg, M.I.T 31


Dept. of Aero & Auto Engg, M.I.T 32
G97 Constant Spindle Speed Setting
Format: N_ G97 S_

The G97 command is used to cancel the G96


setting and set the spindle speed in revolutions
per minute. The tool position does not affect
the spindle speed.

NOTE: Always use the G97 command when


programming any threading cycles.

Dept. of Aero & Auto Engg, M.I.T 33


M-code list
M-codes are miscellaneous functions that include actions necessary for machining
but not those that are actual tool movements (for example, auxiliary functions). They
include spindle on and off, tool changes, coolant on and off, program stops, and
similar, related functions. The following codes are described in detail in the following
sections.
Block Skip “/” used to bypass CNC blocks
Comments “(” and “)” used to help operator comments
Note: Two or more M-codes cannot be included on the same line.

Dept. of Aero & Auto Engg, M.I.T 34


Dept. of Aero & Auto Engg, M.I.T 35
M00 Program Stop
Format: N_ M00
The M00 command is a temporary program stop
function. When it is executed, all functions are
temporarily stopped and will not restart until
prompted by user input. This command is very useful
in lengthy programs as a way to stop the machine in
order to clear chips, take measurements, or adjust
clamps, coolant hoses, and so on.

Dept. of Aero & Auto Engg, M.I.T 36


M01 Optional Program Stop
Format: N_ M01

The M01 command is an optional stop


command that also halts program execution,
but only if the Optional Stop switch is set to
ON. If the Optional Stop switch is set to OFF,
the program will ignore any M01 commands
it encounters in a program and no optional
stops will be executed.

Dept. of Aero & Auto Engg, M.I.T 37


M02 Program End
Format: N_ M02
The M02 command indicates the end of the
main program. This command, instructs the
MCU to switch off all machine operations (for
example, spindle, coolant, all axes, and any
auxiliaries) and terminates the program. This
command appears on the last line of the
program.

Dept. of Aero & Auto Engg, M.I.T 38


M03 Spindle on Clockwise
Format: N_ M03 S_

The M03 command switches the spindle on so that it


rotates clockwise. The spindle speed is designated by
the letter address S followed by the spindle speed in
revolutions per minute. The image shown illustrates
clockwise operation. Dept. of Aero & Auto Engg, M.I.T 39
M04 Spindle on Counterclockwise
Format: N_ M04 S_

The M04 command switches the spindle on so that it rotates


counterclockwise. It is programmed as with the M03 command.
The spindle speed is designated by the letter address S, followed
by the spindle speed in revolutions per minute. The image shown
illustrates counterclockwise operation.
Dept. of Aero & Auto Engg, M.I.T 40
M05 Spindle Stop
Format: N_ M05
The M05 command turns off the spindle. Although
other M-codes turn off all functions (for example,
M00 and M01 ), this command is dedicated to
shutting off the spindle. The M05 command appears
most often at the end of a program, but it can also be
used prior to a tool change command.

Dept. of Aero & Auto Engg, M.I.T 41


M30 Program End, Reset to Start
Format: N_ M30

The M30 command indicates the end of the


program. In other words, no more program
commands follow. This is a remnant of the
older NC machines, which utilized paper tape
and could not differentiate between one
program and the next, so an End of Data
command was developed. Now the M30 is
used to end the program and reset it to the
start.
Dept. of Aero & Auto Engg, M.I.T 42
Start up
➢ Start – Up: The commands in this portion of the
program are used to initialize the controller and the
machine tool for further operation.
O1000
G21/G20 G98/G99
G28 X0 Y0 Z0
M06 T0101
M03/M04 S1000
G00 X21 Z1

Dept. of Aero & Auto Engg, M.I.T 43


➢Body of the program: This portion of the
program consists of the commands that represent
the actual machining part. It changes from job to
job.

➢End of program:
G28 X0 Y0 Z0
M05
M30

Dept. of Aero & Auto Engg, M.I.T 44


1. Write a part program to perform the linear slotting operation on the
component as shown in the figure.

Dept. of Aero & Auto Engg, M.I.T 45


O0001
G21 G94
G91 G28 Z0
G28 X0 Y0
G90
M06 T01
M03 S1000
G00 X10 Y10 Z2
G01 Z-1 F50
X10 Y90
X90 Y90
X90 Y10
X10 Y10
G00 Z5
G91 G28 Z0
G28 X0 Y0
M05 M30

Dept. of Aero & Auto Engg, M.I.T 46


Slot milling
Slot milling
3) Write a part program to obtain the model shown below from the workpiece
of given size.

 49

75
37.5

50
100

2
15

Mill circular slot using end mill of  4 mm


100

 49

75
37.5

50

Tool
5
2
15
100

 49

75
37.5

50

Tool
5
2
15
100

 49

75
37.5

50

Tool
5
2
15
100

 49

75
37.5

50

Tool
5
2
15
100

 49

75
37.5

50

Tool
5
2
15
100
CIRCULAR INTERPOLATION
 49
G 00 G 91 G 28 Z 0

75
G 28 X 0 Y 0
37.5
M06 T01
M 03 S 1300 50
G 90 Z 5 M 08 2
15
G0 X 50 Y 13

G 94 G01 Z -2 F 20
G 02 X50 Y 62 R 24.5 F 50

G 02 X50 Y13 R 24.5

G00 Z 5
G 91 G 28 X 0 Y 0 Z 0
M 05
M 30
Dept. of Aero & Auto Engg, M.I.T 56
Dept. of Aero & Auto Engg, M.I.T 57
TURNING

Dept. of Aero & Auto Engg, M.I.T 58


STANDARD TURNING MACHINE
COORDINATE SYSTEM

Dept. of Aero & Auto Engg, M.I.T 59


Dept. of Aero & Auto Engg, M.I.T 60
CNC words
Sequence number (N – word) : Used to identify the block

Preparatory function(G – word) : To prepare MCU for instructions

Co-ordinates (X, Y, Z – word) : Gives the co-ordinate positions of the tool

Feed rate (F – word) : Specifies feed rate in machining

Spindle speed (S – word) : Specifies spindle speed of the process

Tool selection (T – word) : Specifies which tool is to be used in the process

Miscellaneous function(M – word) : Specifies certain auxiliary function needed and


available in the machine

End of the instruction (EOB): Specifies end of the block


CNC programming

CODES - 2 TYPES
1. G – CODES (preparatory codes)
The preparatory function prepares the MCU circuits to
perform specific mode of operation
2. M – CODES (Miscellaneous codes)
This function gives auxiliary information which does not
relate to dimensional movement of the machine.

Dept. of Aero & Auto Engg, M.I.T 62


MIRAC TURNING CENTRE , DENFORD
G – CODES G 70 FINISHING CYCLE
G 00 POSITIONING (RAPID TRAVERSE) G 71 STOCK REMOVAL IN TURNING
G 01 LINEAR INTERPOLATION G 72 STOCK REMOVAL IN FACING
(FEED)
G 02 CIRCULAR INTERPOLATION (CW) G 73 PATTERN REPEATING

G 74 PECK DRILLING IN Z-AXIS


G 20 INCH DATA INPUT G 76 THREAD CUTTING CYCLE
G 21 METRIC DATA INPUT G 90 TURNING CYCLE
G 28 REFERENCE POINT RETURN G 92 THREAD CUTTING CYCLE
G 94 FACING CYLCE
G 96 CONST. SURFACE SPEED CONTROL

G 97 CONST. SURFACE SPEED


CONTROL CANCEL
G 98 FEED PER MINUTE

Dept. of Aero &G 99Engg, M.I.T


Auto FEED PER REVOLUTION 63
MIRAC TURNING CENTRE , DENFORD
M – CODES
M 00 PROGRAM STOP M 13 SPINDLE FORWARD COOLANT ON

M 01 OPTIONAL STOP M 14 SPINDLE REVERSE COOLANT ON

M 02 PROGRAM RESET M 30 PROGRAM RESET REWIN


D
M 03 SPINDLE FORWARD M 38 DOOR OPEN
M 04 SPINDLE REVERSE M 39 DOOR CLOSE
M 05 SPINDLE STOP M 98 SUB PROGRAM CALL

M 06 AUTO TOOL CHANGE M 99 SUB PROGRAM END

M 08 COOLANT ON

M 09 COOLANT OFF

Dept. of Aero & Auto Engg, M.I.T 64


Based on the programming method
1. Absolute systems

2. Incremental systems

Dept. of Aero & Auto Engg, M.I.T 65


Dept. of Aero & Auto Engg, M.I.T 66
Note:
➢ Incremental program is easy to program but tedious to change
values in between. Error committed in any block is carried over
to the consecutive blocks.
➢ Whereas, absolute programming is a bit inconvenient as all
coordinates are measured from a fixed point. Error committed in
any block will affect only that block. Consecutive blocks are not
affected.

Dept. of Aero & Auto Engg, M.I.T 67


Axes systems used for Turning centre

Z -ve Z=0 Z +ve

Dept. of Aero & Auto Engg, M.I.T 68


Dept. of Aero & Auto Engg, M.I.T 69
Dept. of Aero & Auto Engg, M.I.T 70
G28 - Reference point return
Causes a fast traverse to specified position then to
datum position
Example: G28 X34.0 Z5.0

G28 U0 W0

G96 - CONST. SURFACE SPEED CONTROL


(CSS – m/min )

G97 - CONST. SURFACE SPEED CONTROL CANCEL

(Spindle speed – rev./min )

Dept. of Aero & Auto Engg, M.I.T 71


Program structure

- Start up

- Body of the program

- End of program / tool change

Dept. of Aero & Auto Engg, M.I.T 72


Start up
➢ Start – Up: The commands in this portion of the
program are used to initialize the controller and the
machine tool for further operation.
O1000
G21/G20 G98/G99
G28 U0 W0
M06 T0101
M03/M04 S1000
G00 X21 Z1

Dept. of Aero & Auto Engg, M.I.T 73


➢Body of the program: This portion of the
program consists of the commands that represent
the actual machining part. It changes from job to
job.

➢End of program:
G28 U0 W0
M05
M30

Dept. of Aero & Auto Engg, M.I.T 74


Dept. of Aero & Auto Engg, M.I.T 75
Dept. of Aero & Auto Engg, M.I.T 76
O1001
G21 G98
G28 U0 W0
M06 T0101
M03 S1200
G00 X22 Z1
G01 Z-0.5 F45
G01 X0
G00 Z1
G00 X22
G01 Z-1 F45
G01 X0
G00 Z1
G00 X22
G01 Z-1.5 F45
G01 X0
G00 Z1
G00 X22
G01 Z-2 F45
G01 X0
G00 Z1
G00 X22
G28 U0 W0
M05
M30

Dept. of Aero & Auto Engg, M.I.T 77


2) Write a part program to obtain the model shown below from the
work piece of given size.
0.5 x 4 = 2 mm

 32
Assume width of each facing cut = 0.5 mm

All dimensions are in mm.

Dept. of Aero & Auto Engg, M.I.T 78


Program 3:

(30, 1)

Dept. of Aero & Auto Engg, M.I.T 79


Dept. of Aero & Auto Engg, M.I.T 80

You might also like