CNC Machines Programming
CNC Machines Programming
CNC Machines Programming
(CNC)
1
Numerical Control
⚫ Numerical control is a method of automatically
operating a manufacturing machine based on a
code of letters, numbers, and special characters.
⚫ The numerical data required to produce a part is
provided to a machine in the form of a program,
called part program or CNC program.
⚫ The program is translated into the appropriate
electrical signals for input to motors that run the
machine.
2
Numerical Control - History
⚫ The concept is credited to John Parson (1947). Using
punched cards he was able to control the position of a
machine in an attempt to machine helicopter blade.
⚫ US Air Force teamed up with MIT to develop a
programmable milling machine (1949).
⚫ In 1952, a three-axis Cincinnati Hydrotel milling machine
was demonstrated. The term Numerical Control (NC)
originated. The machine had an electromechanical
controller and used punched cards.
⚫ A new class of machines called machining centers and
turning centers that could perform multiple machining
processes was developed.
⚫ Modern NC machine has a computer on board,
Computer Numerical Control (CNC). They can run
unattended at over 20,000 rpm (spindler speed) with a
feed rate of over 600 ipm and an accuracy of .0001
3
⚫ In CNC (Computer Numerical
Control), the instructions are stored as
a program in a micro-computer
attached to the machine. The
computer will also handle much of the
control logic of the machine, making it
more adaptable than earlier
hard-wired controllers.
4
Hardware Configuration of CNC Machine
Machine Control Unit (MCU)
the brain of the CNC machine.
The Data Processing Unit (DPU)
reads the part program.
The Control Loop Unit (CLU)
controls the machine tool operation.
5
Controller components
2004 7
CNC terminology
Controller components:
1. Data Processing Unit (DPU)
2. Control-Loops Unit (CLU)
Types of CNC machines
Incremental or Absolute
Open Loop vs. Closed Loop controls
Components of Servo-motor controlled CNC
One thread in a screw single start screw: Dist moved in 1 rev = pitch
Two threads in screw double start screw: Dist moved in 1 rev = 2* pitch
EIA/ISO Tape Formats
CNC Controllers
The NC controller is the brain of the NC system, it controls all
functions of the machine.
● Motion control deals with the tool position,
orientation and speed.
22
Continuous-Path Tool Movements
Continuous-path controllers cause the tool to maintain
continuous contact with the part as the tool cuts a contour shape.
These operations include milling along any lines at any angle,
milling arcs and lathe turning.
23
Loop Systems for Controlling Tool Movement
Open Loop System
Uses stepping motor to create movement. Motors rotate a fixed
amount for each pulse received from the MCU. The motor sends a
signal back indicating that the movement is completed. No feedback
to check how close the actual machine movement comes to the exact
movement programmed.
24
Loop Systems for Controlling Tool Movement
Closed Loop System
AC, DC, and hydraulic servo-motors are used. The speed of these
motors are variable and controlled by the amount of current or fluid.
The motors are connect to the spindle and the table. A position sensor
continuously monitors the movement and sends back a single to
Comparator to make adjustments.
25
Flow of Computer-Aided CNC Processing
⚫ Develop or obtain the 3D geometric model of the part,
using CAD.
⚫ Decide which machining operations and cutter-path
directions are required (computer assisted).
⚫ Choose the tooling required (computer assisted).
⚫ Run CAM software to generate the CNC part program.
⚫ Verify and edit program.
⚫ Download the part program to the appropriate machine.
⚫ Verify the program on the actual machine and edit if
necessary.
⚫ Run the program and produce the part.
26
Basic Concept of Part Programming
Part programming contains geometric data about the part
and motion information to move the cutting tool with
respect to the work piece.
Basically, the machine receives instructions as a sequence
of blocks containing commands to set machine parameters;
speed, feed and other relevant information.
A block is equivalent to a line of codes in a part program.
N135 G01 X1.0 Y1.0 Z0.125 T01 F5.0
27
Basic Concept of Part Programming
Preparatory command (G code)
The G codes prepare the MCU for a given operation, typically
involving a cutter motion.
G00 rapid motion, point-to-point positioning
G01 linear interpolation (generating a sloped or straight cut)
G06 parabolic interpolation (produces a segment of a parabola)
G17 XY plane selection
G02 circular interpolation CW
G28 automatic return to reference point
G33 thread cutting
28
Basic Concept of Part Programming
Miscellaneous commands (M code)
M00 program stop
M03 start spindle rotation (cw)
M06 tool change
M07 turn coolant on
Feed commands (F code)
Used to specify the cutter feed rates in inch per minute.
Speed commands (S code)
Used to specify the spindle speed in rpm.
Tool commands (T code)
Specifies which tool to be used, machines with
automatic tool changer.
29
CNC Machine Axes of Motion
The coordinate system used for the tool path must be identical to the
coordinate system used by the CNC machine. The standards for machine
axes are established according to the industry standard report EIA RS-267A.
Vertical
milling
machine
Horizontal
milling
machine
31
More complex CNC machines have the capability of executing
additional rotary motions (4th and 5th axes).
32
Five-axis
machine
configurations
33
Advantages of CNC
⚫ Higher productivity
⚫ Quality (more accurate and less scrap)
⚫ Reduced inventory (reduces setup time)
⚫ Machining complex shapes
⚫ Management control (process planning
and product planning)
34
Drawbacks of CNC
⚫ High capital cost
Machine tools cost $1,50,000 -
$35,00,000
⚫ Retraining and recruitment of staff
⚫ New support facilities
⚫ High maintenance requirements
⚫ Not cost-effective for low-level
production on simple parts
⚫ Maintenance personnel must have both
mechanical and electronics expertise
35
Engine Block made from a single cast
iron block using a CNC machine
2004 36
Aircraft Turbine Machined by
5-Axis CNC Milling Machine
2004 37
Basic Machine Axes: 3 axis
⚫ Milling Machines: 3 axis
X – axis (table left and right)
Y – axis (table in and out)
Z – axis (usually the spindle
axis)
Additional Axes
⚫ G – Code Programming
⚫ Originally called the “Word Address”
programming format.
Individual Words
Tape Formats
⚫ Word Address Format
Numerical codes or values are prefixed with an Alphabet. Order in
which codes are entered in a block is not important.
Eg. G00, G90, M06, X100.00 etc
⚫ Tab Sequential Format
Codes and/ or numerical values are entered in a fixed order
separated by tab key.
Eg. 50 tab 90 tab 01tab ......
⚫ Fixed Block Format
Most inflexible of the three formats. Codes or numerical values are
entered in a fixed order. Not only must the words in each block be
in identical sequence, but the characters within each word must be
the same length and format. If a word remains the same from
block to block, it must nevertheless be repeated in each block.
44
Tape Formats
EXAMPLE
In an NC drilling operation, two holes must be drilled in sequence at the
following coordinate locations :
Hole 1: x = 2.000 y = 2.500
Hole 2: x = 4.000 y = 2.500
45
Word Address 1
⚫ N – Sequence or line number
⚫ A tag that identifies the beginning of a block of code.
It is used by operators to locate specific lines of a
program when entering data or verifying the program
operation.
⚫ G – Preparatory function
⚫ G words specify the mode in which the milling
machine is to move along its programmed axes.
Word Address 2
⚫ Dimension Words
X – Distance or position in X direction
Y – Distance or position in Y direction
Z – Distance or position in Z direction
⚫ M – Miscellaneous functions
⚫ M words specify CNC machine functions not related
to dimensions or axial movements.
Word Address 3
⚫ F – Feed rate (inches per minute or millimeters per
minute)
⚫ Rate at which cutting tool moves along an axis.
⚫ T – Tool number
⚫ Specifies tool to be selected.
Word Address 4
⚫ G17 – XY plane
⚫ G18 – XZ plane
⚫ G19 – YZ plane
⚫ G20 – Inch Mode
⚫ G21 – Metric Mode
⚫ G28 – Return to axis machine Zero (Home)
G Codes: G90, G91
G90 – Absolute Coordinate Reference
References the next position from an absolute
zero point which is set once for the entire
program.
G91 – Incremental Coordinate Reference
References the next position from the previous
position.
G Codes: Canned Cycles
⚫ Part Zero
◦ Used for absolute programming mode.
◦ Usually a position on the part that all absolute
coordinates are referenced to.
◦ Changes with different parts and programs.
⚫ Two methods:
• Linear interpolation – cut a path along a
specified angle at a specified feed rate.
• Circular interpolation – cut a path along an
arc or circle at a specified feed rate.
Axis movements: Caution!
⚫ Multiple axis movements are possible.
67
CNC Control Panel
68
69
70
71
CNC Programming Milling- example
72
CNC Programming Milling- example
O1234 (Program No)
N5 G00 G54 G90 G17 X-20 Y-20 Z50
N10 S450 M03 F250 D01 (12.5 MM DIA)
N15 C0
N20 Z5
N25 G01 Z0
N30 Z-5
N35 G42 X0 Y0
N40 X30
N45 Y30
N50 X0
N55 Y0
N60 G40 X-20 Y-20
N65 G00 Z50
N70 Y100
N75 M30
73
CNC Programming Lathe - Example
O0001
N1 G90 G54 G94
N2 T0101
N3 G0 X100 Z50
N4 M3 S600
N5 M8
N6 G1 X50 Z0 F600
N7 Z-30 F200
N8 X80 Z-50 F150
N9 G0 X100 Z50
N10 T0100
N11 M5
N12 M9
N13 M30
74
Address Letters
75
Meaning of
Word Address
76
77
78
79
Programming
Example
80
81
Canned cycles: G70, G71, G72
Fanuc G71 Turning Cycle
G71 turning cycle is used for rough-material removal from
a CNC lathe component. G71 turning cycle makes large
diameter cutting easy. Cutting can be done in simple
straight line or a complex contour can also be machined
very easily.
Through G71 turning cycle parameters CNC machinists
can control
⚫ Depth of cut.
⚫ Retract height.
⚫ Finishing allowance in x-axis and z-axis.
⚫ Cycle cutting-feed, spindle speed.
82
Canned cycles: G70, G71, G72
83
Canned cycles: G70, G71, G72
84
Canned cycles: G70, G71, G72
85
Canned cycles: G70, G71, G72
86
Canned cycles: G70, G71, G72
87
Canned cycles: G70, G71, G72
88
Canned cycles: G70, G71, G72
89
Milling-Subroutines
90
Milling-Subroutines
Since the tool diameter is 80 mm. and the width of the plate is 100 mm., two
cuts are
required at each depth. The tool path at each cut is:
Rapid downwards 1 mm. in Z.
Feed right till tool periphery is a little beyond the material 91
Milling-Subroutines
Since the tool diameter is 80 mm. and the width of the
plate is 100 mm., two cuts are required at each depth. The
tool path at each cut is:
⚫ Rapid downwards 1 mm. in Z.
⚫ Feed right till tool periphery is a little beyond the
material.
⚫ Feed up till tool periphery is a little beyond the material.
⚫ Feed left till tool periphery is a little beyond the material.
⚫ Rapid down to start position.
92
Milling-Subroutines
93
Milling-Subroutines
94