SlideShare a Scribd company logo
1 of 29
Download to read offline
CNC Programming
CNC Programming
Lecture 25
Lecture 25
Engineering 475
Engineering 475
Automated Production Systems
Automated Production Systems
Information Needed by a CNC
Information Needed by a CNC
Machine
Machine
1. Preparatory Information: units, incremental or
absolute positioning
2. Coordinates: X,Y,Z, RX,RY,RZ
3. Machining Parameters: Feed rate and spindle
speed
4. Coolant Control: On/Off, Flood, Mist
5. Tool Control: Tool and tool parameters
6. Cycle Functions: Type of action required
7. Miscellaneous Control: Spindle on/off, direction
of rotation, stops for part movement
This information is conveyed to the machine through a set
of instructions arranged in a desired sequence – Program.
Cartesian Coordinate Systems
Cartesian Coordinate Systems
Consists of three axes positioned 90
degrees from each other.
Chang, Fig. 10.1
Right Hand Rule
Right Hand Rule
X
Y
Z
The right hand rule is used to define the
positive direction of the coordinate axes.
Nanfara, Fig. 2.1
Standard Lathe
Standard Lathe
Coordinate System
Coordinate System
Nanfara, Fig. 2-4
Gantry Mill Coordinate
Gantry Mill Coordinate
System
System
Nanfara, Fig. 2-3
Vertical Mill or Drill
Vertical Mill or Drill
Coordinate System
Coordinate System
Chang, Fig. 10.3
Milling Tool Coordinate System
Milling Tool Coordinate System
Nanfaro, Fig. 2-6(b)
Cartesian Coordinate
Cartesian Coordinate
System Planes
System Planes
Nanfaro, Fig. 2-7
X-Y Plane
X-Z Plane
Y-Z Plane
Absolute Coordinates
Absolute Coordinates
x
Nanfaro, Fig. 2-10
Incremental Coordinates
Incremental Coordinates
Nanfaro, Fig. 2-11
Coordinate System Exercise
Coordinate System Exercise
Letter Codes
Letter Codes
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30
Example CNC Program
• Each instruction to the machine
consists of a letter followed by
a number.
• Each letter is associated with a
specific type of action or piece
of information needed by the
machine.
N,G,X,Y,Z,A,B,C,I,J,K,F,S,T,R,M
Letters used in Codes
Letter Codes
Letter Codes
(G and M Codes)
(G and M Codes)
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30
Example CNC Program
•G-codes: Preparatory Functions
– involve actual tool moves.
•M-codes: Miscellaneous
Functions – involve actions
necessary for machining (i.e.
spindle on/off, coolant on/off).
Letter Codes
Letter Codes
(G Codes)
(G Codes)
G00 Rapid traverse
G01 Linear interpolation
G02 Circular interpolation, CW
G03 Circular interpolation, CCW
G04 Dwell
G08 Acceleration
G09 Deceleration
G17 X-Y Plane
G18 Z-X Plane
G19 Y-Z Plane
G20 Inch Units (G70)
G21 Metric Units (G71)
G40 Cutter compensation – cancel
G41 Cutter compensation – left
G42 Cutter compensation- right
G70 Inch format
G71 Metric format
G74 Full-circle programming off
G75 Full-circle programming on
G80 Fixed-cycle cancel
G81-G89 Fixed cycles
G90 Absolute dimensions
G91 Incremental dimensions
Letter Codes
Letter Codes
(M Codes)
(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
Letter Codes
Letter Codes
(N Codes)
(N Codes)
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30
Example CNC Program
•N-codes: Gives an
identifying number for each
block of information.
It is generally good practice to
increment each block number by
5 or 10 to allow additional
blocks to be inserted if future
changes are required.
Letter Codes
Letter Codes
(X,Y, and Z Codes)
(X,Y, and Z Codes)
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30
Example CNC Program
• X, Y, and Z codes are used to
specify the coordinate axis.
• Number following the code
defines the coordinate at the end
of the move relative to an
incremental or absolute
reference point.
• The number may require that a
specific format be used (i.e. 3.4
means three numbers before
the decimal and four numbers
after the decimal).
Letter Codes
Letter Codes
(I,J, and K Codes)
(I,J, and K Codes)
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30
Example CNC Program
• I, J, and K codes are used to
specify the coordinate axis
when defining the center of a
circle.
• Number following the code
defines the respective coordinate
for the center of the circle.
• The number may require that a
specific format be used (i.e. 3.4
means three numbers before
the decimal and four numbers
after the decimal).
Letter Codes
Letter Codes
(F, S, and T Codes)
(F, S, and T Codes)
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30
Example CNC Program
F-code: used to specify the feed
rate
S-code: used to specify the
spindle speed
T-code: used to specify the tool
identification number associated
with the tool to be used in
subsequent operations.
Letter Codes
Letter Codes
(R and P Codes)
(R and P Codes)
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30
Example CNC Program
R-code:
•Retract distance when used with
G81, 82, and 83.
•Radius when used with G02 and
G03.
P-code: Used to specify the
dwell time associated with
G04.
Program Start Flag and Program
Program Start Flag and Program
Identification Number
Identification Number
% Program start flag. Placed at
the beginning of each program.
:1025 Program identification number.
Follows the program start flag
at the beginning of each
program.
%
:1045
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
Example CNC Program
Example CNC Program
Only two commands that
don’t start with a letter.
Three Major Phases of a CNC
Three Major Phases of a CNC
Program
Program
Nanfara, pg. 36
Phase 1
Phase 1 -
- Program Setup
Program Setup
% (Program start flag)
:1001 (Four digit program number)
N5 G90 G20 (Absolute units, inches)
N10 M06 T2 (Stop for tool change, use tool # 2)
N15 M03 S1200 (Turn the spindle on CW to 1200 rpm)
Three Major Phases of a CNC
Three Major Phases of a CNC
Program
Program
Phase 2
Phase 2 –
– Material Removal
Material Removal
N20 G00 X1 Y1 (Rapid to X1,Y1 from origin point)
N25 Z0.125 (Rapid down to Z0.125)
N30 G01 Z-0.125 F5 (Feed down to Z-0.125 at 5 ipm)
N35 G01 X2 Y2 (Feed diagonally to X2,Y2)
N40 G00 Z1 (Rapid up to Z1)
N45 X0 Y0 (Rapid to X0,Y0)
Nanfara, pg. 36
Three Major Phases of a CNC
Three Major Phases of a CNC
Program
Program
Phase 3
Phase 3 –
– System Shutdown
System Shutdown
N50 M05 (Turn the spindle off)
N55 M30 (End of program)
Nanfara, pg. 36
Block Format
Block Format
N135 G01 X1.0 Y1.0 Z0.125 F5
Sample Block
• Restrictions on CNC blocks
• Each may contain only one tool move
• Each may contain any number of non-tool move G-codes
• Each may contain only one feedrate
• Each may contain only one specified tool or spindle speed
• The block numbers should be sequential
• Both the program start flag and the program number must be
independent of all other commands (on separate lines)
• The data within a block should follow the sequence shown
in the above sample block
Nanfara, pg. 36
Modal G
Modal G-
-Codes
Codes
Most G-codes set the
machine in a “mode”
which stays in effect
until it is changed or
cancelled by another G-
code. These commands
are called “modal”.
N5 G90 G20
N10 M06 T3
N15 M03 S1250
N20 G00 X1 Y1
N25 Z0.1
N30 G01 Z-0.125 F5
N35 X3 Y2 F10
N40 G00 Z1
N45 X0 Y0
N50 M05
N55 M30
Example CNC Program
In the example, G00 and
G01 are modal.
Modal G
Modal G-
-Code List
Code List
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
Assignment
Assignment
Review the material presented.
Next class we look at an example,
and will develop G-code programs
in class.

More Related Content

Similar to Lecture 25.pdf

Similar to Lecture 25.pdf (20)

CNC
CNCCNC
CNC
 
Cnc part programming 4 unit
Cnc part programming 4 unitCnc part programming 4 unit
Cnc part programming 4 unit
 
CNC(computerized Numeric Coding) Lecture.pptx
CNC(computerized Numeric  Coding) Lecture.pptxCNC(computerized Numeric  Coding) Lecture.pptx
CNC(computerized Numeric Coding) Lecture.pptx
 
CNC MILLING
CNC MILLINGCNC MILLING
CNC MILLING
 
CNC1.ppt
CNC1.pptCNC1.ppt
CNC1.ppt
 
CNC1 (1).ppt
CNC1 (1).pptCNC1 (1).ppt
CNC1 (1).ppt
 
CNC Training.ppt
CNC Training.pptCNC Training.ppt
CNC Training.ppt
 
Cnc1
Cnc1Cnc1
Cnc1
 
CNC1.ppt
CNC1.pptCNC1.ppt
CNC1.ppt
 
Computer integrated Manufacture & design Lab Manual
Computer integrated Manufacture & design Lab  ManualComputer integrated Manufacture & design Lab  Manual
Computer integrated Manufacture & design Lab Manual
 
CNC1.ppt
CNC1.pptCNC1.ppt
CNC1.ppt
 
5 g-code
5   g-code5   g-code
5 g-code
 
CNC Turning.ppt
CNC Turning.pptCNC Turning.ppt
CNC Turning.ppt
 
Akshit
AkshitAkshit
Akshit
 
CNC(COMPUTER NUMERICAL CONTROL MACHINE) By-Er. VED PRAKASH
CNC(COMPUTER NUMERICAL CONTROL MACHINE) By-Er. VED PRAKASHCNC(COMPUTER NUMERICAL CONTROL MACHINE) By-Er. VED PRAKASH
CNC(COMPUTER NUMERICAL CONTROL MACHINE) By-Er. VED PRAKASH
 
Cnc pgrming seminar-
Cnc pgrming   seminar-Cnc pgrming   seminar-
Cnc pgrming seminar-
 
Cnc programming
Cnc programmingCnc programming
Cnc programming
 
Cncprogramming
CncprogrammingCncprogramming
Cncprogramming
 
Cnc programming
Cnc programmingCnc programming
Cnc programming
 
4 basic cnc programming milling
4 basic cnc programming milling4 basic cnc programming milling
4 basic cnc programming milling
 

Recently uploaded

Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escortsranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxhumanexperienceaaa
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSKurinjimalarL3
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxupamatechverse
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxwendy cai
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024hassan khalil
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCall Girls in Nagpur High Profile
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 

Recently uploaded (20)

DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCRCall Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
Call Us -/9953056974- Call Girls In Vikaspuri-/- Delhi NCR
 
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
(MEERA) Dapodi Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Escorts
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptxthe ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
the ladakh protest in leh ladakh 2024 sonam wangchuk.pptx
 
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICSAPPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
APPLICATIONS-AC/DC DRIVES-OPERATING CHARACTERISTICS
 
Introduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptxIntroduction to IEEE STANDARDS and its different types.pptx
Introduction to IEEE STANDARDS and its different types.pptx
 
What are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptxWhat are the advantages and disadvantages of membrane structures.pptx
What are the advantages and disadvantages of membrane structures.pptx
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024Architect Hassan Khalil Portfolio for 2024
Architect Hassan Khalil Portfolio for 2024
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service NashikCollege Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
College Call Girls Nashik Nehal 7001305949 Independent Escort Service Nashik
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 

Lecture 25.pdf

  • 1. CNC Programming CNC Programming Lecture 25 Lecture 25 Engineering 475 Engineering 475 Automated Production Systems Automated Production Systems
  • 2. Information Needed by a CNC Information Needed by a CNC Machine Machine 1. Preparatory Information: units, incremental or absolute positioning 2. Coordinates: X,Y,Z, RX,RY,RZ 3. Machining Parameters: Feed rate and spindle speed 4. Coolant Control: On/Off, Flood, Mist 5. Tool Control: Tool and tool parameters 6. Cycle Functions: Type of action required 7. Miscellaneous Control: Spindle on/off, direction of rotation, stops for part movement This information is conveyed to the machine through a set of instructions arranged in a desired sequence – Program.
  • 3. Cartesian Coordinate Systems Cartesian Coordinate Systems Consists of three axes positioned 90 degrees from each other. Chang, Fig. 10.1
  • 4. Right Hand Rule Right Hand Rule X Y Z The right hand rule is used to define the positive direction of the coordinate axes. Nanfara, Fig. 2.1
  • 5. Standard Lathe Standard Lathe Coordinate System Coordinate System Nanfara, Fig. 2-4
  • 6. Gantry Mill Coordinate Gantry Mill Coordinate System System Nanfara, Fig. 2-3
  • 7. Vertical Mill or Drill Vertical Mill or Drill Coordinate System Coordinate System Chang, Fig. 10.3
  • 8. Milling Tool Coordinate System Milling Tool Coordinate System Nanfaro, Fig. 2-6(b)
  • 9. Cartesian Coordinate Cartesian Coordinate System Planes System Planes Nanfaro, Fig. 2-7 X-Y Plane X-Z Plane Y-Z Plane
  • 13. Letter Codes Letter Codes N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Example CNC Program • Each instruction to the machine consists of a letter followed by a number. • Each letter is associated with a specific type of action or piece of information needed by the machine. N,G,X,Y,Z,A,B,C,I,J,K,F,S,T,R,M Letters used in Codes
  • 14. Letter Codes Letter Codes (G and M Codes) (G and M Codes) N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Example CNC Program •G-codes: Preparatory Functions – involve actual tool moves. •M-codes: Miscellaneous Functions – involve actions necessary for machining (i.e. spindle on/off, coolant on/off).
  • 15. Letter Codes Letter Codes (G Codes) (G Codes) G00 Rapid traverse G01 Linear interpolation G02 Circular interpolation, CW G03 Circular interpolation, CCW G04 Dwell G08 Acceleration G09 Deceleration G17 X-Y Plane G18 Z-X Plane G19 Y-Z Plane G20 Inch Units (G70) G21 Metric Units (G71) G40 Cutter compensation – cancel G41 Cutter compensation – left G42 Cutter compensation- right G70 Inch format G71 Metric format G74 Full-circle programming off G75 Full-circle programming on G80 Fixed-cycle cancel G81-G89 Fixed cycles G90 Absolute dimensions G91 Incremental dimensions
  • 16. Letter Codes Letter Codes (M Codes) (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
  • 17. Letter Codes Letter Codes (N Codes) (N Codes) N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Example CNC Program •N-codes: Gives an identifying number for each block of information. It is generally good practice to increment each block number by 5 or 10 to allow additional blocks to be inserted if future changes are required.
  • 18. Letter Codes Letter Codes (X,Y, and Z Codes) (X,Y, and Z Codes) N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Example CNC Program • X, Y, and Z codes are used to specify the coordinate axis. • Number following the code defines the coordinate at the end of the move relative to an incremental or absolute reference point. • The number may require that a specific format be used (i.e. 3.4 means three numbers before the decimal and four numbers after the decimal).
  • 19. Letter Codes Letter Codes (I,J, and K Codes) (I,J, and K Codes) N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Example CNC Program • I, J, and K codes are used to specify the coordinate axis when defining the center of a circle. • Number following the code defines the respective coordinate for the center of the circle. • The number may require that a specific format be used (i.e. 3.4 means three numbers before the decimal and four numbers after the decimal).
  • 20. Letter Codes Letter Codes (F, S, and T Codes) (F, S, and T Codes) N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Example CNC Program F-code: used to specify the feed rate S-code: used to specify the spindle speed T-code: used to specify the tool identification number associated with the tool to be used in subsequent operations.
  • 21. Letter Codes Letter Codes (R and P Codes) (R and P Codes) N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Example CNC Program R-code: •Retract distance when used with G81, 82, and 83. •Radius when used with G02 and G03. P-code: Used to specify the dwell time associated with G04.
  • 22. Program Start Flag and Program Program Start Flag and Program Identification Number Identification Number % Program start flag. Placed at the beginning of each program. :1025 Program identification number. Follows the program start flag at the beginning of each program. % :1045 N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 Example CNC Program Example CNC Program Only two commands that don’t start with a letter.
  • 23. Three Major Phases of a CNC Three Major Phases of a CNC Program Program Nanfara, pg. 36 Phase 1 Phase 1 - - Program Setup Program Setup % (Program start flag) :1001 (Four digit program number) N5 G90 G20 (Absolute units, inches) N10 M06 T2 (Stop for tool change, use tool # 2) N15 M03 S1200 (Turn the spindle on CW to 1200 rpm)
  • 24. Three Major Phases of a CNC Three Major Phases of a CNC Program Program Phase 2 Phase 2 – – Material Removal Material Removal N20 G00 X1 Y1 (Rapid to X1,Y1 from origin point) N25 Z0.125 (Rapid down to Z0.125) N30 G01 Z-0.125 F5 (Feed down to Z-0.125 at 5 ipm) N35 G01 X2 Y2 (Feed diagonally to X2,Y2) N40 G00 Z1 (Rapid up to Z1) N45 X0 Y0 (Rapid to X0,Y0) Nanfara, pg. 36
  • 25. Three Major Phases of a CNC Three Major Phases of a CNC Program Program Phase 3 Phase 3 – – System Shutdown System Shutdown N50 M05 (Turn the spindle off) N55 M30 (End of program) Nanfara, pg. 36
  • 26. Block Format Block Format N135 G01 X1.0 Y1.0 Z0.125 F5 Sample Block • Restrictions on CNC blocks • Each may contain only one tool move • Each may contain any number of non-tool move G-codes • Each may contain only one feedrate • Each may contain only one specified tool or spindle speed • The block numbers should be sequential • Both the program start flag and the program number must be independent of all other commands (on separate lines) • The data within a block should follow the sequence shown in the above sample block Nanfara, pg. 36
  • 27. Modal G Modal G- -Codes Codes Most G-codes set the machine in a “mode” which stays in effect until it is changed or cancelled by another G- code. These commands are called “modal”. N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Example CNC Program In the example, G00 and G01 are modal.
  • 28. Modal G Modal G- -Code List Code List 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
  • 29. Assignment Assignment Review the material presented. Next class we look at an example, and will develop G-code programs in class.