You are on page 1of 5

Three Major Phases of a CNC Program

Phase 1 - Program Setup


% (Program start flag)
: 1001 (Four digit program number)
N5 G90 G20 (Absolute units, inches)
N5 G91 G21/G71 (Incremental units, Metric Units)
N10 M06 T2 (Stop for tool change, use tool # 2)
N15 M03 S1200 (Turn the spindle on CW to 1200 rpm)

(OR)

Phase 2 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)

Phase 3 System Shutdown


N50 M05 (Turn the spindle off)
N55 M30 (End of program)

Block Format
N135 G01 X1.0 Y1.0 Z0.125 F5
Preparatory Function (G Codes)
A 2-digit number following address G determines the meaning of the command of the
block concerned. The G codes are divided into the following two types:
TYPES
One shot G codes
Model G codes

MEANING
The G codes is effective only at the block in which it was specified
The G codes is effective until another g code in the same group is
commanded
NOTE ON G CODES
Maximum spindle speed setting (G50) is valid when the constant surface speed control
(option) is provided
The G codes are marked * are set when the power is turned ON
The G codes in group 00 are not modal. They are effective only in the block in which they
are specified.
A number of G codes can be specified in a block even if they do not belong to the same
group. When a number of G codes of the same group are specified, G code specified last
is effective
All the G codes may not apply to each machine

G codes
G Code
G00

Group
1

Function
Positioning (Rapid Transverse)

G01

Linear Interpolation (Feed)

G02

Circular Interpolation (CW)

G03
G04
G20

1
0
6

Circular Interpolation (CCW)


Dwell
Inch Data Input

G21
G28
G32
G40

6
9
1
7

Metric Data Input


Reference Point Return
Thread Cutting
Tool nose radius compensation cancel

G41

Tool nose radius compensation left

G42
G50
G70

7
0
4

Tool nose radius compensation right


Word co-ord. Change / Max. Spindle speed setting
Finishing cycle

G71
G72

4
0

Stock removal in turning


Stock removal in facing

G73

Pattern repeating

G74

Peck drilling in Z axis

G75

Grooving in X axis

G76
G90

0
1

Thread cutting cycle


Cutting cycle A

G92

Thread cutting cycle

G94
G96

1
2

Cutting cycle B
Constant surface speed control

G97
G98

2
11

Constant surface speed control cancel


Feed per minute

G99

11

Feed per revolution

MISCELLANEOUS FUNCTION (M CODES)

M Codes are instructions describing miscellaneous functions like calling the Tool,
Spindle rotation, Coolant ON etc
.

M-CODES

FUNCTIONS

MOO

Program Stop

MO1

Optional Stop

MO2

Program end

MO3

Spindale Forward(CW)

MO4

Spindale Forward (CCW)

MO5

Spindle stop

MO6

Tool change

MO8

Coolant ON

M09

Coolant OFF

M10

Chuck Open

M11

Chuck close

M62

Output1 ON

M63

Output 2 ON

M64

Output 1OFF

M65

Output 2OFF

M66

Wait input 1 ON

M67

Wait input 2 ON

M76

Wait input 1 OFF

M77

Wait input 2 OFF

M98

Sup program Call

M99

Sup program Exit

Program build-up for CNC Lathe (FANUC)


CNC program can be divided into 3 parts
Start-up
Body
End of program

Start-up of CNC program


O1000
[BILLET X20 Z60
G21/G20 G98/G99 G40
G50 S1800
G28 U0 W0
M06 T0101
M03/M04 S1000
G00 X21 Z1
EXPLANATION
O1000
[BILLET X20 Z60
G21/G20 G98/G99 G40

G50 S1800
G28 U0 W0
M06
T0101
M03/M04 S1000
G00 X21 Z1

While writing a program on FANUC controller first line has to be


started with letter O followed by four digit number which specifies
the program name
This directive is used only for simulation purpose. It defines the work
piece dimensions as 60mm long and 20mm in diameter.
G21 This code specifies that program is done in metric units
Or
G20 This code specifies that program is done in imperial units
G98 Gives the unit of feed in mm/minute
Or
G99 give the unit of feed in mm/revolution
G40 Compensation cancel
Clamps the spindle speed at 1800 rpm
Make the tool to go to home position. U & W are secondary
movements about X and Z axis
Tool change
The first two digit specify the tool position in the turret and last two
digits denotes the tool offset number
M03 Makes the spindle rotate in clockwise direction
M04 Makes the spindle to rotate in counter-clockwise direction
S1000 Spindle rotates at 1000rpm
G00 Gives rapid position of the tool to a point X21 Z1

Body of the program


This is dealt operation wise in the succeeding pages.

End of program

G28 U0 W0
M05
M30
EXPLANATION
G28 U0 W0
M05
M02/M30

Make the tool to go to home position. U & W are secondary movements


about X and Z axis
Stop the spindle rotation
M02 Optional stop
M30 Program stop and rewind

METAL CUTTING PARAMETERS FOR STAR TURN LATHE


BILLET MATERIAL: ALUMINIUM/STEEL etc.
Operations
TURNING
GROOVING
THREADING

Speed
rpm
1000 - 2500 (up to
max. of machine
spec.)
600 - 800(up to max.
of machine spec.)
300 - 3530(up to max.
of machine spec.)

Feed
mm/min.

Depth of cut
Mm

45 55(up to max. of
machine spec.)

0.5 1.0(up to max.


of machine spec.)

15- 25(up to max. of


machine spec.)

0.25 0.5(up to max.


of machine spec.)
0.03-0.04(up to max.
of machine spec.)

You might also like