CNC Programming Course Material
CNC Programming Course Material
Control
Unit
CNC Ball Screw
The motion control
• Depending on the application, motion
control can refer to:
– simple on-off control or
– a sequencing of events,
– controlling the speed of a motor,
– moving objects from one point to another
– precisely constraining the speed,
acceleration, and position of a system
throughout a move
Controlled actuation
Perception
(sensing)
Controlled
Intelligence Environment
(control)
Action
(actuation)
Drive system:
general arrangement
• General arrangement of a drive system is
presented below:
Motor
Speed Reference
Control Power
Circuits Circuits
Tacho
Speed Feedback
Open Control System
Closed System
Machine Controller
Control Interface
Control System
On/off Switch •Power and Control Switch
Coolant switch
Input Devices to the Machines
• Input devices:
– Punched Cards
– Tape
– MDI
– Diskette
– Magnetic Tape
NC Codes
• Bit 0 or 1
• Character ( a collection of 8 bit) across a row
• Address ( the letter used before each word to define the meaning.
– A Angular Dimension in X axis
– G Preparatory Function
– M Miscellaneous function
– X Primary motion in X axis
• Word A collection of Character ( Address followed by number)
– N10 or G01 …..etc
• Block A collection of Words
• N10 G01 X 10.0 ( three word Block)
• N05 Go1 X10.01 Y 30.5 Z 5.8 ( five word Block)
• Program A collection of Blocks
WORD ADDRESS FORMAT
• N... G.. X.. Y.. Z.. I.. J.. K.. F.. H.. S.. T.. M
Con’t
Characters
6 F . -
Word
F 275.0 G01
Block
N 5 G 0 1 Y – 6 Y – 6. 4 8 F 2 7 5 . 0
Mathematics for NC
Cont’t
What is Numerical Control?
• ( EIA) Electronic Industries Association
– A System in Which actions are controlled by
the direct insertion of Numerical data at some
points
• The coded instruction are converted into
two types of Instructions:
– Pulses of Output signals
– ON/OFF Control Signals
NC Controller Technology
• Vacuum tubes 1952
• Relays 1955
• Semiconductors 1960
• IC 1965
• DNC 1968
• CNC 1970
Types of NC
• NC
• DNC ( Direct Numerical Controlled
Machines)
• DNC ( Distributed Numerically Controlled
• CNC ( Computerized Numerically Control
Machines)
CNC
Direct Numerical Control
• Introduced in the 1966
– To get ride of the
Punched Tape
Distributed Numerically Control
• Introduced after 1980
– Network
– Advanced
Communication
– Integrated to other
– Production Planning
Activities
Elements of CNC
Mathematics for NC
Cont’t
To Machine a part
• 1- Prepare a plan
• 2- Prepare tool(s)
• 3- Set-up
• 4- Loading and executing program
Plan ?
• Where is My Origin ?
• What is the shape of My raw
Material ( Blank)
• Who to Fix My Blank ? 1"
• What are the main
Operations?
• What are the needed tools ?
• How to Sequence the
operations
Tooling
• Command Mode
• MDI ( manual data mode )
• Manual bottom is used to toggle between
them.
Manual
Command Mode
• Command Mode is to set up the machine
• To run a program.
MDI mode
• MDI stands for Manual Data Input
– Single Blocks of G and M codes can be typed
• May be used to set fixture and toll offsets
CNC Programming Syntax
Parts for a CNC Program
• Program Startup
• Tool Safety Block
• Tool Load Blocks
• Tool Motion Blocks
• Tool Cancel Blocks
• End of Tape Blocks
Program Start up
• % O 1000
• (**** programmer is Mr. Ali…***)
• (* it is used to cut Aluminum*)
• (* for steel Please reduce the override knobs
to 50 %*)
Tool Safety Block
• The tool safety block is used to
• issue commands to cancel for any machine
modes that could have been left active.
• M6T07
Tool Motion Blocks
• Rapid Movement (G00)
• Interpolation (G02,G03)
• Fixed Cycles
• Subroutines
Tool Cancel Blocks
• Tool cancel blocks turns off the tool length
compensation and returns to the tool change
position
End tape
• End of program code
• M02 or M30
Grouping of Codes
Interpolation
• Linear Interpolation
• Circular Interpolation
• Helical Interpolation
• NURBS Interpolation
Linear Interpolation
• The Term Linear means that the controller
is capable of generating thousands of
intermediate steps between the tart point
and the end point of the cut.
• N..G..G..X..Y..R..Z..P..Q..I..J..F..L..(k..)
• N = Block Number • Z= Z-axis end
• G first G Position= Z depth
• G second G • P Dwell Time
• X = hole position in X • Q depth of peck
• Y hole position in Y • I shift in X
• R=Z axis start • J shift in Y
position = R level • F feeedrate
• L or K repetitions
Why?
• Machining Holes is the most Common type
done on CNCN mills and Machining
Centers.
• It is Called Point to Point drilling
• Drilling is characterized by repetitive type
of programming.
Point-to-Point Machinig
• Step1
– Rapid motion to the hole location (X, and Y)
• Step2
– Rapid Motion in along Z to the cut start
• Step3
– Feedrate to the Specified Depth
• Step4
– Return to the Clear
Hole Pattern
X 2.047 X 3.87 X5.9
Y 3.4
Y 1.89
Example
With canned cycle
• G20
• G17G40G80
• G90G54G00X5.9Y1.89S900M03
• G43z1.0h01m08
• G99G82R0.1Z-0.6813P200F5
• X3.87Y3.4
• X2.047
• G80G28X2.047Y3.4Z1.0
Canned Cycle
Con’t
• R level Selection
0.1
2.25
0.225
incremental
G81 drilling Cycle
• G98G81X..Y..R..Z..F..
G82 Spot Drilling
• G99G82 X…Y…R…Z…P…F…
G73 Deep Hole Drilling
G83 Peck Drilling
• G98G83X..Y..R..Z..Q..F..
G73 Peck Drilling HS
• G98G73X..Y..R..Z..Q..F..
G84 Tapping Cycle
• G89G84X..Y..R..Z..F..
Fixed Cycle Cancellation
• G80
Fixed Cycle Repetitions
• L and K address
• G81X17.Y20.R0.15Z-2.4 L1
• X22L1
• X27. L1
• G80
• L0 means do not execute
Machining Holes
Circular Interpolation
G02, G03
Why ?
Desired
• If we do not have to machine the circle:
h a
• Go 01 ax ay az
• G01 bx by bz g b Programmed
• path
G01 cx cy cz
• G01 dx dy bz c
f
• G01 fx fy fz
• G01 gx gy gz e d
• G01 hx hy hz
Circular Interpolation
• G02 CW
• G03 CCW
Con’t
G02 Format
• IJK ( Arc Radius )
Arc Direction
Con’t
Con’t
Arc Method
Arc Method
• G17 G03 Xxx.xxx Yyy.yyy Rrrr.rrr Fff.fff
Example
IJK Method
Arc Method
Cutter Compensation Lecture7
G41 G42 G40
• G40 Cutter Comp Cancelled
18º 2.25
1.125 R0.625
2.25
Point No. X Y
1 0 0
2 0 1.125
3 2.25 1.8561
4 2.25 .625
5 1.625 0
6
Point No X Y
1 -0.375 -0.375
2 -0.375 1.3975
3 2.625 2.3722
4 2.625 0.625
5 2.62 -0.375
6
Program with Cutter Comp
• G17G20G40G80
• G90E1g00 x –0.625 y –0.625 S1000 M03
• G43 Z1.0 H01
• G01 Z –0.55 F 25.0 M08
• G41 X0 D14 F30
• Y 1.125
• X2.25Y1.8561
• Y0.625
• G02X1.625Y0 R0.625
• G01X-0.625
• G00 G40 Y-0.625
• Z1.0 M09
• G28 X-0.625 Y-0.625
• M30
Towards a better Understanding
of CAM Programming
Objective
tool
Turning
Raw Material
Finished Piece
Finished Piece Stock
Milling
Understanding The Process
How The Tool Path Generation Process Works?
Tool Selection
Operation Steps
b) Finishing
Tool Path Generation in Commercial CAD/CAM
SurfaceSystems
Linearization
Mathematical Errors
Due to linearization
How the Linearization
(digitization) works?
Manual
Programming/
Blueprint/ Machine
CAD file
or G Code
CAM Part
Programming
Example Manual Programming
• Write the Plane (Define
operation Steps)
• For each operation define
tool and write the
Coordinate Sheet
• For each Sheet write the
Corresponding Gcode file
• Send these File(s) to the
machine
• Perform set-up and
machine the part
CAD Drawing
Plan
Operation 12
Operation
RAISE FACE CIRCULAR MILLING
CIRCULAR MILLING
RAISE FACE Operation 3
Center Milling
CENTER
HOLE
CIRCULAR MILLING
CONTOUR CIRCULAR MILLING
10 HOLES SPOT DRILLING
DEEP PECK
DRILLING
GRAPHICAL CORDIANTE SHEET
Text COORDINATE SHEET 1
7000
:
PROGRAMME
R: PAOLA GUTIERREZ
X Y Z R (I,J)
Contouring
Drilling
Internal Pocketing
Example of 2.5 D Operation
3-D operation
3- Axis 5-Axis
Summery and Conclusion
• This presentation is intended to provide an
overview of CAM programming
• The first step to improve CAM System Utilization
is to improved users understanding of CAM
Modeling
• CAM system is a must in 2-5 D operation till 5-
axis machining
• In 1-D and 2-D it depends on the user knowledge
and skills