Coordinates
X, Y, Z XZ, YZ
2
CNC Programming
Coolant control
On or off Flood or mist
Tool control
Tool type Tool parameters
3
CNC Programming
Direction of rotation
Clockwise Counter-clockwise
4
CNC Programming
5
CNC Programming
6
CNC Programming
7
CNC Programming
Vertical Motion
9
CNC Programming
10
CNC Programming
Absolute Coordinates
11
CNC Programming
Incremental Coordinates
12
CNC Programming
Letter Codes
Instructions consist of a letter followed by a number Each letter indicated a specific type of action or information for the machine.
Letters used: N, G, X, Y, Z, I, J, K, F, S, T, M, R
13
CNC Programming
14
CNC Programming
15
CNC Programming
17
CNC Programming
M Codes
18
CNC Programming
N-codes
N-codes give an identifying number for each block of information. Increment lines by 5 or 10 Not necessary for machine
19
CNC Programming
20
CNC Programming
21
CNC Programming
Dimension words
22
CNC Programming
23
CNC Programming
CNC Programming
24
Phases of Programming
Phase 1 Program Setup
Phase 2 Material Removal Phase 3 Program Shutdown
25
CNC Programming
Phase 1
Program Setup
CNC Programming 26
Program Number
All CNC programs require a program number. Used to identify specific programs. Allows the multiple storage of programs in memory. Program number usually has an O followed by a 4 digit number. EX: O1025
27
CNC Programming
Safe lines
Safe lines are used to establish the operating parameters of the program and cancel unwanted information from previous programs. Setup line first line of the program that will establish:
Plane selection Programming system Coordinate mode
CNC Programming
28
Sample Program
%O1000 N5 G00 G17 G20 G90 (setup) N10 G40 G49 G80 G98 (cancellation) N15 G43 H5 M06 T2
G17 can be replaced with G18 or G19 G20 can be replaced with G21 G90 can be replaced with G91
CNC Programming
29
Safe Lines
Cancellation line is used to cancel any information from a previous program. Second line of a program and contains:
Cutter compensation cancel Tool length offset cancel Canned cycle cancel Return to reference position
30
CNC Programming
Cancellation Line
%O1000 N5 G00 G17 G20 G90 (setup) N10 G40 G49 G80 G98 (cancellation) N15 G43 H5 M06 T2 G40 Cancel cutter radius compensation G49 Cancel tool length compensation G80 Cancel canned cycle
31
CNC Programming
Phase 2
Material Removal
CNC Programming 32
Material Removal
N20 G00 X0 Y0 Z.1 M03 S2500 (rapid to XY 0 Z- .1 spindle on clockwise N25 G01 Z-.125 F10. (Feed 10 ipm into part .125) N30 G01 X0 Y2.5 (Feed in Y direction 2.5) N35 G00 Z1 (rapid to Z1)
33
CNC Programming
Phase 3
Program Shutdown
CNC Programming 34
Program Shutdown
N50 M05 (spindle off) N55 G91 G28 X0 Y0 Z0 (return to machine home) N60 M30 (program end, return to first line)
35
CNC Programming
Block Formatting
N100 G01 X1 Y1 Z.125 F10 Restriction on block programming
Can only contain one tool movement No more than 4 G-codes per line Only one feed rate per line Only one spindle speed per line Only one M-code per line
36
CNC Programming
Modal Codes
Most G-codes set the machine in a mode which will remain in effect until it is changed by another G-code.
Example: G00 and G01 are modal
37
CNC Programming
Modal Codes
38
CNC Programming
Modal Codes
39
CNC Programming
Putting it together
40
CNC Programming
41
CNC Programming