History of CNC
1949
US Air Force asks MIT to develop a "numerically
controlled" machine.
1952
Prototype NC machine demonstrated (punched tape input)
1980-
CNC machines (computer used to link directly to controller)
1990-
DNC: external computer “drip feeds” control
programmer to machine tool controller
Motivation and uses
To manufacture complex curved geometries in 2D
or 3D was extremely expensive by mechanical
means (which usually would require complex jigs to
control the cutter motions)
Machining components with repeatable accuracy
Unmanned machining operations
Advantages of CNC
- Easier to program;
- Easy storage of existing programs;
- Easy to change a program
- Avoids human errors
- NC machines are safer to operate
- Complex geometry is produced as cheaply as simple
ones
- Usually generates closer tolerances than manual
machines
Conventional milling machines
Vertical milling machine
Conventional milling machines
Vertical Milling machine architecture
Conventional milling machines
Horizontal Milling machine architecture
How does the table move along X- Y- and Z- axes ?
Numerical Control
Programming
NC PART PROGRAMMING
Introduction
• Coordinate Systems
• NC Words
6.1.1 Coordinate System
Z AXIS Z // rotating spindle
workpiece-rotating machine:
Z is parallel to the spindle Z
tool-rotating machine:
Z is parallel to the tool axis
Z
Z
6.1.1 Coordinate System
X AXIS X // table
workpiece-rotating machine:
X
X is the direction of tool movement Z
horizontal milling machine :
X axis is parallel to the table
vertical machine :
+X axis points to the right
when the programmer X
Z
Z
is facing the machine.
X
CNC Programming Basics
CNC instructions are called part program
commands.
When running, a part program is interpreted one
command line at a time until all lines are completed.
Commands, which are also referred to as blocks, are
made up of words which each begin with a letter
address and end with a numerical value.
CNC Programming Basics
Each letter address relates to a specific machine
function. “G” and “M” letter addresses are two of the
most common. A “G” letter specifies certain
machine preparations such as inch or metric modes,
or absolutes versus incremental modes.
A “M” letter specifies miscellaneous machine
functions and work like on/off switches for coolant
flow, tool changing, or spindle rotation. Other letter
addresses are used to direct a wide variety of other
machine commands.
CNC programming
Important things to know:
• Coordinate System
• Units, incremental or absolute positioning
• Coordinates: X,Y,Z, RX,RY,RZ
• Feed rate and spindle speed
• Coolant Control: On/Off, Flood, Mist
• Tool Control: Tool and tool parameters
CNC programming
Programming consists of a series of instructions in form of
letter codes
Preparatory Codes:
G codes- Initial machining setup and establishing operating
conditions
N codes- specify program line number to executed by the MCU
Axis Codes: X,Y,Z - Used to specify motion of the slide along
X, Y, Z direction
Feed and Speed Codes: F and S- Specify feed and spindle
speed
Programming Key Letters
O - Program number (Used for program identification)
N - Sequence number (Used for line identification)
G - Preparatory function
X - X axis designation
Y - Y axis designation
Z - Z axis designation
R - Radius designation
F – Feed rate designation
S - Spindle speed designation
H - Tool length offset designation
D - Tool radius offset designation
T - Tool Designation
M - Miscellaneous function
Explanation of commonly used G
codes
• G00 – Preparatory code to control final position of the
tool and not concerned with the path that is followed in
arriving at the final destination.
• G01 – Tool is required to move in a straight line
connecting current position and final position. Used for
tool movement without any machining- point to point
control. (linear interpolation)
• G02 – Tool path followed is along an arc specified by I, J
and K codes.( circular interpolation)
Table of Important G codes
G00 Rapid Transverse
G01 Linear Interpolation
G02 Circular Interpolation, CW
G03 Circular Interpolation, CCW
G17 XY Plane,G18 XZ Plane,G19 YZ Plane
G20/G70 Inch units
G21/G71 Metric Units
G40 Cutter compensation cancel
G41 Cutter compensation left
G42 Cutter compensation right
G43 Tool length compensation (plus)
G43 Tool length compensation (plus)
G44 Tool length compensation (minus)
G49 Tool length compensation cancel
G80 Cancel canned cycles
G81 Drilling cycle
G82 Counter boring cycle
G83 Deep hole drilling cycle
G90 Absolute positioning
G91 Incremental positioning
Table of Important M codes
M00 Program stop
M01 Optional program stop
M02 Program end
M03 Spindle on clockwise
M04 Spindle on counterclockwise
M05 Spindle stop
M06 Tool change
M08 Coolant on
M09 Coolant off
M10 Clamps on
M11 Clamps off
M30 Program stop, reset to start
6.1.5 NC Words
N, G, X, Y Z, A, B, C, I, J, K, F, S, T, R, M
N: specify the sequence number
G: preparatory word
to prepare for control functions (the motion of each axis,
coordinate system, coordinate plane, cutter radius
compensation, tool length offset……)
M: miscellaneous word
to control miscellaneous functions (spindle on/off,
start/stop the machine, turn on/off the coolant, change the
tool, and rewind the program tape)
6.1.5 NC Words
6.1.5 NC Words
M CODES
M00 Program stop M06 Tool change
M01 Optional stop M07 Flood coolant on
M02 End of program M08 Mist coolant on
M03 Spindle CW M09 Coolant off
M04 Spindle CCW M30 End of tape
6.1.5 NC Words
modal groups
6.1.5 NC Words
M CODES modal groups
M00 Program stop M06 Tool change
M01 Optional stop M07 Flood coolant on
M02 End of program M08 Mist coolant on
M03 Spindle CW M09 Coolant off
M04 Spindle CCW M30 End of tape
6.1.5 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
6.1.5 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
6.1.5 NC Words
N, G, X, Y, Z, A, B, C, I, J, K, F, S, T, R, M
R: specify the clearance height
in canned-cycle
N0010 G81 X1.000 Y2.000 Z0.000 R1.300
Operations in drill cycle G81 :
1. Rapid to location (1,2,2).
2. Rapid down to the R plane:(1,2,1.3)
3. Feed to the Z point, the bottom of the hole:(1,2,0)
4. Operation at the bottom of the hole .
5. Rapid or feed to either the R plane or the initial height.
APT Programming Example
Cylindrical Part
F 25
Raw Material
70
F 22.5
F 17.5
Finished Part
20
30
APT Programming Example (Cylindrical Part)
O0013
N0005 G53
N0010 T0303
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X22.50 Z2.0 S500
N0080 G01 Z-30.0 F100
N0090 G00 X23.0 Z2.0 S500
N0100 G84 X17.5 Z-20.0 D0=200 D2=200 D3=650
N0110 G00 Z2.0
N0120 X50.0 Z50.0
N0130 M30
APT Program Interpretation
O0013
Program identification number
APT Program Interpretation
O0013
N0005 G53
To cancel any previous working zero point
APT Program Interpretation
O0013
N0005 G53
N0010 T0303
N0010 Sequence number
T0303 Select tool number 303
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.0 Z0.0 S500 M04
G57 To set the working zero point as saved
G00 Rapid movement (no cutting)
X26.0 X location (as a diameter; 13 form zero)
Z0.0 Z location
S500 Spindle speed is 500 rpm
M04 Rotate spindle counterclockwise
x
+ve
z
(0,0) +ve
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
G01 Linear interpolation (cutting)
X-0.20 Move only in x direction until you pass
the center by 0.1 mm (facing)
F100 Set feed rate to 100 mm/min.
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
G00 Move rapidly away from work piece (no cutting)
Z2.0 the movement is 2 mm away from the face.
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
Go to a safe location away from the
workpiece [x = 50 (25 from zero), z = 50] to
change the tool.
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
T0404 Select tool number 404
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X22.50 Z2.0 S500
G57 PS0
G00 Rapid movement (no cutting)
X22.50 X location (as a diameter; 11.25 form zero)
Z2.0 Z location
S500 Spindle speed is 500 rpm
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X25.00 Z2.0 S500 M04
N0080 G01 Z-30.0 F100
G01 Linear interpolation (cutting)
Z-30 Move only in z direction (external turning)
F100 Set feed rate to 100 mm/min.
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X25.00 Z2.0 S500 M04
N0080 G01 X22.5 Z-70.0 F100
N0090 G00 X23.0 Z2.0 S500
G00 Move rapidly away from work piece (no cutting) to
location x= 23.0 (11.50 from zero) and z = 2.0.
O0013 APT Program Interpretation
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X25.00 Z2.0 S500 M04
N0080 G01 X22.5 Z-70.0 F100
N0090 G00 X26.0 Z2.0 S500
N0100 G84 X17.5 Z-20.0 D0=200 D2=200 D3=650
G84 Turning cycle for machining the step
X17.5 final diameter
Z-20 length of step is 20 mm
D0=200 Finish allowance in X direction (0.2 mm) D2=200 Finish
allowance in Z direction (0.2 mm)
D3=650 Depth of cut in each pass (0.65 mm)
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X25.00 Z2.0 S500 M04
N0080 G01 X22.5 Z-70.0 F100
N0090 G00 X26.0 Z2.0 S500
N0100 G84 X17.5 Z-20.0 D0=200 D2=200 D3=650
N0110 G00 Z2.0
G00 Move rapidly away from workpiece (no cutting)
Z2.0 the movement is 2 mm away from the face.
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X25.00 Z2.0 S500 M04
N0080 G01 X22.5 Z-70.0 F100
N0090 G00 X26.0 Z2.0 S500
N0100 G84 X17.5 Z-20.0 D0=200 D2=200 D3=650
N0110 G00 Z2.0
N0120 X50.0 Z50.0
X50.0 Z50.0 Move to the tool changing location
APT Program Interpretation
O0013
N0005 G53
N0010 T0404
N0020 G57 G00 X26.00 Z0.0 S500 M04
N0030 G01 X-0.20 F100
N0040 G00 Z2.0
N0050 X50.0 Z50.0
N0060 T0404
N0070 G57 G00 X25.00 Z2.0 S500 M04
N0080 G01 X22.5 Z-70.0 F100
N0090 G00 X26.0 Z2.0 S500
N0100 G84 X17.5 Z-20.0 D0=200 D2=200 D3=650
N0110 G00 Z2.0
N0120 X50.0 Z50.0 T00
N0130 M30
M30 Program End