CNC Lecture
CNC Lecture
Programming basics
Programming Key Letters
1. O - Program number (Used for program identification)
2. N - Sequence number (Used for line identification)
3. EOB - End of Block (;,Lf, *)
4. G - Preparatory function
5. M - Miscellaneous function
6. X - X axis designation
7. Y - Y axis designation
8. Z - Z axis designation
9. R - Radius designation
10. F - Feed rate designation
11. S - Spindle speed designation
12. T - Tool Designation
Codes used…..
G code Function M code Function
G00 Positioning-Rapid M00 Program stop
Traverse
G01 Linear interpolation M01 Program optional stop
G02 Circular Interpolation- M02 Program end
CW
G03 Circular Interpolation- M03 Spindle on CW
CCW
G04 dwell M04 Spindle on CCW
G20 Input in inch M05 Spindle of
G21 Input in mm M06 Tool change
G28 Return to home position M08 Coolant on
G94 Canned cycle for M09 Coolant of
turning
G96 Feed in mm/min M30 Program end & rewind
G97 Feed in mm/rev M98 Subprogram call
Axis & sign conventions (Turning)
- ve
(0,0)
- ve Z +
ve
+
ve
Zero Points
Part/workpiece zero
Machine zero or machine home
position
Reference zero
ø 50 mm
Workpiece zero
. . (0,0)
Reference zero
100 mm
Machine zero
.
2 mm
2 mm
Example
Initial blocks
O 2016;
N01 G21 G97;
S1000 F0.5 T0203 M03;
M08;
Format for program
Tool
Block
number Special
number
function
Final blocks
M05;
M09;
M02;
G28 U0W0;
Part program for facing operation using G00& G01
code
Use:
Depth of cut = 1.2 mm
Tool no. = 04, ofset no. = 05
Feed = 0.2 mm/rev.
ø 80 mm
5 mm
.
100 mm
O 2009;
N2 G 21 G 97 G 99;
N4 T0404 S 2000 M03;
N6 M08;
N8 G00 X82 Z2;
N10 G00 Z0;
N12 G01 X-1 F0.2;
N14 G00 X82 Z2;
N16 G00 Z -1.2;
N18 G01 X-1 F0.2;
N20 G00 X 82 Z2;
N22 G00 Z -2.4;
N24 G01 X-1 F0.2;
N26 G00 X 82 Z2;
G94 TURNING CYCLE
Rapid traverse (DOC) in ‘z’ Start point
axis
Feed
(cutting Feed
motion) (retrieval)
in ‘x’ in ‘x’ axis
axis
Feed
(retrieva Rapid
l) traverse
in ‘x’ (DOC)
axis in ‘x’ axis