CNC Machines Programming

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

Computer Numeric Control

(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

Data Processing Unit:


Input device [RS-232 port/ Tape Reader/ Punched Tape Reader]
Data Reading Circuits and Parity Checking Circuits
Decoders to distribute data to the axes controllers.

Control Loops Unit:


Interpolator to supply machine-motion commands between data
points
Position control loop hardware for each axis of motion
CNC System Elements

2004 7
CNC terminology

BLU: basic length unit


smallest programmable move of each axis.

Controller: (Machine Control Unit, MCU)


Electronic and computerized interface between operator and m/c

Controller components:
1. Data Processing Unit (DPU)
2. Control-Loops Unit (CLU)
Types of CNC machines

Based on Motion Type:


Point-to-Point or Continuous path

Based on Control Loops:

Open loop or Closed loop

Based on Power Supply:

Electric or Hydraulic or Pneumatic

Based on Positioning System

Incremental or Absolute
Open Loop vs. Closed Loop controls
Components of Servo-motor controlled CNC

Motor lead screw rotation table moves

Motor speed control feedback position sensed by encoder

Two types of encoder configurations


Motion Control and feedback

Encoder outputs: electrical pulses (e.g. 500 pulses per revolution)

Rotation of the motor linear motion of the table: by the leadscrew

The pitch of the leadscrew: horizontal distance between successive threads

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.

● Auxiliary control deals with spindle rpm, tool


change, fixture clamping and coolant.

Many different types of controllers are available in the


market (GE, Fanuc, Allen-Bradley, Okuma, Bendix, …).

There are two basic types of control systems:


point-to-point and continuous path.
21
Point-to-Point Tool Movements
Point-to-point control systems cause the tool to move to a
point on the part and execute an operation at that point only.
The tool is not in continuous contact with the part while it is
moving.
Drilling, reaming, punching, boring and tapping are examples
of point-to-point operations.

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

Coordinates Special function


Block number
G-code Tool number

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.

Right hand rule

Vertical
milling
machine
Horizontal
milling
machine

CNC machines milling machines can perform


simultaneous linear motion along the three
axis and are called three-axes machines.
30
Coordinate system for a Lathe

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

⚫ A – axis (angular axis about X - axis)


⚫ B – axis (angular axis about Y – axis)
⚫ C – axis (angular axis about Z – axis)

⚫ U – axis (secondary axis parallel to X)


⚫ V – axis (secondary axis parallel to Y)
⚫ W – axis (secondary axis parallel to Z)
Milling Machines: 4 axis
Terminology
⚫ NC – Numerical Control
⚫ CNC – Computer Numerical Control
⚫ DNC – Direct Numerical Control
⚫ APT – Automatic Programmed Tool
⚫ CAD – Computer Aided Design
⚫ CAM – Computer Aided Manufacturing
⚫ CIM – Computer Integrated Manufacturing
G - Code Programming

⚫ G – Code Programming
⚫ Originally called the “Word Address”
programming format.

⚫ Processed one line at a time sequentially.


Common Format of a Block

Sequence Preparatory Dimension Feed Spindle Tool Misc.


# Function Words Rate Function Function Function

N50 G90 G01 X1.40Y2.25 F10 S1500 T01 M03

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

In the word address format, the two statements would read


N001 X2.000 Y2.500 F2.87 S573 EOB
N002 X4.000 EOB
In the tab sequential format, the two blocks would be
001 TAB 2.00 TAB 2.50 TAB 2.87 TAB 573 EOB
002 TAB 4.00 TAB TAB TAB EOB
We are using TAB and EOB to denote the codes for the tab key and
end-of-block (carriage return) on the Flexowriter. In the fixed block
format, the two blocks would be
001 +02.000 +02.500 2.87 573 EOB
002 +04.000 +02.500 2.87 573 EOB

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.

⚫ S – Spindle speed (rpm – revolutions per minute)


⚫ Controls spindle rotation speed.

⚫ T – Tool number
⚫ Specifies tool to be selected.
Word Address 4

⚫ I – Circular cutting reference for x axis

⚫ J – Circular cutting reference for y axis

⚫ K – Circular cutting reference for z axis


G Word

⚫ G words or codes tell the machine to


perform certain functions. Most G words are
modal which means they remain in effect until
replaced by another modal G code.
Common G Codes
⚫ G00 – Rapid positioning mode
⚫ Tool is moved along the shortest route to
programmed X,Y,Z position. Usually NOT used for
cutting.
⚫ G01 – Linear Interpolation mode
⚫ Tool is moved along a straight-line path at
programmed rate of speed.

⚫ G02 – Circular motion clockwise (cw)


⚫ G03 – Circular motion counter clockwise
(ccw)
Common G Codes, con.,

⚫ 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

⚫ G80 – Cancel canned cycle


⚫ G81 – Drilling cycle
⚫ G83 – Peck drilling cycle
⚫ G84 – Tapping cycle
⚫ G85 – Boring cycle
⚫ G86 – Boring cycle

⚫ NOTE: A canned cycle stays in effect until cancelled


by a G80.
Canned Cycles: G81

⚫ G81 – Drilling Cycle


⚫ Feed to depth, rapid return

⚫ Example of program code:


⚫ N35 G81 X.500Y.500Z-1.000 R.100 F1.50
⚫ N36 X1.000Y1.500
⚫ N37 X1.500Y2.000
⚫ N38 G80
Canned Cycles: G83, G84
⚫ G83 – Peck Drilling Cycle
⚫ Feed to an intermediate depth, rapid out, rapid back
to just above previous depth, feed to next depth,
rapid out, repeat until reaching full depth.

⚫ G84 – Tapping Cycle


⚫ This cycle creates internal threads in an existing
hole.
⚫ NOTE: One cannot over-ride the feed rate.
Canned Cycles: G85, G86

⚫ G85 - Boring Cycle


⚫ Feed to depth, feed back out.

⚫ G86 – Boring Cycle


⚫ Feed to depth, rapid out.
G Codes: Cutter Compensation
⚫ G40 – Cancel cutter diameter compensation.

⚫ G41 – Cutter compensation left.

⚫ G42 – Cutter compensation right.


M Word

⚫ M words tell the machine to perform certain


machine related functions, such as: turn
spindle on/off, coolant on/off, or stop/end
program.

Professional Development ID Code: 6006


Common M words
⚫ M00 – Programmed pause
⚫ Automatically stops machine until operator pushes a button to
resume program.

⚫ M01 – Optional stop


⚫ A stop acted upon by the machine when operator has signaled
this command by pushing a button.

⚫ M02 – End of program


⚫ Stops program when all lines of code are completed. Must be
last command in program.
Common M words
⚫ M03 – Turn spindle on
⚫ In clockwise direction

⚫ M04 – Turn spindle on


⚫ In counter clockwise direction

⚫ M05 – Stop spindle


⚫ Usually used prior to tool change or at end of program.

⚫ M06 – Tool change


⚫ Stops program and calls for a tool change, either
automatically or manually.
Common M words
⚫ M08 – Turns Accessory 1 on.
⚫ M09 – Turns Accessory 1 off.

⚫ M10 – Turns Accessory 2 on.


⚫ M11 – Turns Accessory 2 off.

⚫ M30 – End of program


⚫ Similar to M02 but M30 will also “rewind” the program.
Must be last statement in program. If used, DO NOT use
M02.
Zero Points

⚫ 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.

⚫ Machine Zero or Machine Home Position


◦ Fixed for each machine from the manufacturer.
◦ Not changeable.
Cutter Path Generation

⚫ Cutter path is generated by moving the tool


from point to point. The points are previously
defined from the part drawing dimensions.

⚫ Each line of code will show the destination


point of where the tool will go to.
Interpolation
⚫ Method of determining intermediate
points along a cutting path.

⚫ 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.

⚫ “Best Practice” is NOT to make a 3-axis


movement using one line of code.

⚫ Move to position using two axes, X,Y;


then move the Z with an additional line of
code.
CNC Control Panel

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

You might also like