Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
3 views

cnc programming

The document provides a comprehensive overview of CNC programming fundamentals, including machine axes, addressing commands, and G/M codes for various functions. It explains the use of absolute (G90) and incremental (G91) commands for movement, as well as details on feed rates, spindle speeds, and programming examples. Additionally, it covers specific commands for circular interpolation and dwell functions, along with practical learning activities for calculating RPM and feed rates.

Uploaded by

mechanicalearth
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

cnc programming

The document provides a comprehensive overview of CNC programming fundamentals, including machine axes, addressing commands, and G/M codes for various functions. It explains the use of absolute (G90) and incremental (G91) commands for movement, as well as details on feed rates, spindle speeds, and programming examples. Additionally, it covers specific commands for circular interpolation and dwell functions, along with practical learning activities for calculating RPM and feed rates.

Uploaded by

mechanicalearth
Copyright
© © All Rights Reserved
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 56

Basic Programming

Fundamentals of CNC Programming


for Machining Centers

1
Applications Engineering ASIA INDIA
Understanding of Machine Axes

Y+

X- X+

From Drawing Y-

2
Applications Engineering ASIA INDIA
Address in Program

What is ‘address’
Address is the use of alphabet characters
to regulate the functions of a machine tool.
The commands are shown on next slide.

3
Applications Engineering ASIA INDIA
Sample of Address
Function Address Meaning
Program number O O1000 ( test )
Sequence number N N10, N20, N30
Preparatory Function G G00, G01, command machine
Dimensional words X,Y,Z Axes travel command
R Arc radius
I, J, K Arc center coordinates
Feed rate F F500 ( mm/min )
Spindle function S S1000 ( rpm )
Tool function T T10 ( Tool number 10 )
Miscellaneous Function M M3, M5, on/off control m/c
Offset number H,D H1 ( tool length), D32 ( radius )
Dwell P,X Dwelling time
Program number command P Sub program number

4
Applications Engineering ASIA INDIA
Program number O & Comment
Function of program number O
%
O1000 ( MAKINO )
• O xxxx follow by four digits number
• ( ------- ) comment or message

O0001 - O7999 ( User area )


O8000 - O8999 ( User area )
( Program protection is possible
O9000 - O9999 ( Maker area )
( Program protect is possible )

5
Applications Engineering ASIA INDIA
Sequence Number N
Function of sequence number Nxxxx
• Use number from ( 1-99999 or 1-9999 )
• Can be used for program restart
• Use at changes in the process for easy access

1, Every block 2, At any Block


O0001 O0001
N1 N1
N2 --
N3 --
N4 M30 N99 M30

6
Applications Engineering ASIA INDIA
Movement Command & Setting Units
To move machine axis command
• Axes are X, Y, Z, A, B, C, U, V, W
• Providing a decimal point

All mean move 50 mm Note

X50. • X 50 = 0.05 mm
X50.0 • X 1.23456 = X1.235
X50.00
• X1.23456789 = alarm more
X50.000
X50000 than 9 digits

7
Applications Engineering ASIA INDIA
Absolute G90
Function G90
• The destination of movement is specified with the
coordinate value regardless the current position.
Y+
60
Y+

10 10
X+ X+
10 60 10
G90 X60.0 Y10.0 ; G90 X10.0 Y60.0 ;

8
Applications Engineering ASIA INDIA
Incremental G91
Function G91
• The movement is specified by the direction and the
incremental value to the destination referring the
current position. Y+
60
Y+

10 10
X+ X+
10 60 10
G91 X50.0 ; G91 Y50.0 ;

9
Applications Engineering ASIA INDIA
Absolute G90 & Incremental G91
For dimensional command use G90 or G91
• Hereafter, G90 and G91 are abbreviated as ABS & INC
respectively in the text..

From point A to point B Y+


ABS G90 X60.0 Y60.0 ; B
60
INC G91 X40.0 Y40.0 ;
From point B to point A
20 A
ABS G90 X20.0 Y20.0 ; X+
INC G91 X- 40.0 Y -40.0 ; 20 60

10
Applications Engineering ASIA INDIA
Information of ABS & INC
Which is more convenient ?
ABS is better
• when each hole position is
indicated from a reference
point, programming is made
easy by setting as origin.
INC is better
• when the pitch between the
position of each hole is
indicated.
• when position with the same
pitch is repeated.

11
Applications Engineering ASIA INDIA
G CODES
G00 : Positioning in rapid
G01 : Linear positioning in feed
G02 : Circular Interpolation CW
G03 : Circular Interpolation CCW
G04 : Dwell
G10 : Data Setting
G17 : XY Plane Selection
G18 : ZX Plane Selection
G19 : YZ Plane Selection
G20 : Input In Inch
G21 : Input In Metric
G28 : Return To Reference Position
G30 : 2nd, 3rd and 4th Reference Position Return
G31 : Skip Function
G40 : Cutter Compensation Cancel
G41 : Cutter Compensation Left
G42 : Cutter Compensation Right
12
Applications Engineering ASIA INDIA
G43 : Tool Length Compensation + Direction
G44 : Tool Length Compensation - Direction
G53 : Setting Machine Coordinate System Selection
G54 : Work Piece Coordinate System 1
G55 : Work Piece Coordinate System 2
G56 : Work Piece Coordinate System 3
G57 : Work Piece Coordinate System 4
G58 : Work Piece Coordinate System 5
G59 : Work Piece Coordinate System 6
G65 : Macro Call
G73 : Peck Drilling Cycle
G80 : Canned Cycle Cancellation
G81 : Drilling Cycle
G82 : Counter Boring Cycle
G83 : Peck Drilling Cycle
G84 : Tapping Cycle
G85 : Boring Cycle
G86 : Fine Boring Cycle

13
Applications Engineering ASIA INDIA
G90 : Absolute Command
G91 : Increment Command
G94 : Feed Per Minute
G95 : Feed Per Rotation
G98 : Return To Initial Point In Canned Cycle
G99 : Return To R Point In Canned Cycle

14
Applications Engineering ASIA INDIA
G CODES G CODES
FOR FOR
AXES CANNED
MOTION CYCLES

G CODES

G CODES G CODES
FOR FOE TOOL
REFERENCE COMPENSATION

15
Applications Engineering ASIA INDIA
G CODES FOR AXES MOVEMENTS

G00 :Rapid positioning


G01 :Linear interpolation
G02 :Circular Interpolation CW
G03 :Circular Interpolation CCW

16
Applications Engineering ASIA INDIA
G CODES FOR REFERENCES

G53 :Setting Machine Coordinate System Selection


G54 :Work Piece Coordinate System 1
G55 :Work Piece Coordinate System 2
G56 :Work Piece Coordinate System 3
G57 :Work Piece Coordinate System 4
G58 :Work Piece Coordinate System 5
G59 :Work Piece Coordinate System 6
G90 :Absolute Command
G91 :Increment Command

17
Applications Engineering ASIA INDIA
G CODES FOR TOOL COMPENSATION

G40 :Cutter Compensation Cancel


G41 :Cutter Compensation Left
G42 :Cutter Compensation Right
G43 :Tool Length Compensation + Direction
G44 :Tool Length Compensation - Direction

18
Applications Engineering ASIA INDIA
G CODES FOR CANNED CYCLES

G73 :Short Peck Drilling Cycle


G80 :Canned Cycle Cancellation
G81 :Drilling Cycle
G82 :Counter Boring Cycle
G83 :Long Peck Drilling Cycle
G84 :Tapping Cycle
G76 :Fine Boring Cycle
G86 :Boring Cycle
G98 :Return To Initial Point In Canned Cycle
G99 :Return To R Point In Canned Cycle

19
Applications Engineering ASIA INDIA
Miscellaneous Function M code
Address M and the follow numerals control on / off of machine
function. Such as the spindle rotation start or stop .

M00 Program stop


After executing the block in which M00 is specified , automatic operation
stops. This function is used for Inspection , tool setting etc.
M01 Optional stop
After executing a block in which M01 is specified, automatic operation
stops in the same way as M00 does . However, it does this only when the
optional stop switch on the machine control panel is turned on.

M03 Spindle CW start


The main spindle rotates in a clockwise direction.

M04 Spindle CCW start


The main spindle rotates in counterclockwise directions.

20
Applications Engineering ASIA INDIA
M05 Spindle rotation stop.
The main spindle stops rotating.

M08 Coolant on
Flood coolant is supplied.

M09 Coolant off


M07 is cancelled.

M30 Program end


This shows the end of main program.

M98 Subprogram call

M99 Subprogram end


This command shows the end of the subprogram

21
Applications Engineering ASIA INDIA
Feed rate F & Spindle Speed S
Function F and S code
These are given according to the tools to be used
and the material of them, workpiece to be cut.

F01 1 mm/min
F10.0 10 mm/min
F1000 1000 mm/min
S10 10 revolutions per min ( rpm )
S1500 1500 revolutions per min.
S400 400 revolutions per min.

22
Applications Engineering ASIA INDIA
RPM & Feed Formula
Cutting Speed ( m/min ) * 318
RPM =
Diameter

Milling Feed = RPM * No. of tooth * Feed per tooth

Drill Feed = RPM * Feed per revolution

Tap Feed = RPM * Pitch

23
Applications Engineering ASIA INDIA
Learning Activity
Calculation RPM & Feed
• Cutting Speed = 250 m/min
• Cutting Diameter = Ø 10 mm
• No. of tooth = 2
• Feed per tooth = 0.1
• Your answer is

RPM = 7950 Feed = 1590

24
Applications Engineering ASIA INDIA
Learning Activity
Calculation Cutting Speed & Feed per tooth

• Rpm = 15000 rev/min


• Feed = 3000 mm/min
• No of tooth = 2
• Cutter diameter = 6 mm
• Your Answer is

Cutting Speed = 283 Feed per tooth = 0.1

25
Applications Engineering ASIA INDIA
Rapid Traverse G00
Linear Interpolation G01
Rapid Traverse ( G00 )
• The cutter moves at a rapid traverse rate
with non-linear or linear interpolation.
• The rapid traverse rate depends on the
machine type.

Cutting Feed ( G01 )


• Command G01 is used to cut
straight lines
• The feed rate is specified
with F in the program

26
Applications Engineering ASIA INDIA
Sample of Program
O1000 ( MAKINO )
N1 G90 G54 G00 X0 Y0 S1000 200
M03 ;
N2 G01 X0 Y-50.0 F100 ;
N3 X100.0 ;
100
N4 Y50.0 ;
N5 X-100.0 ;
N6 Y-50.0 ; Y+

N7 X0 ;
X- X+
N8 Y0 ;
N9 M30 ; Y-

27
Applications Engineering ASIA INDIA
Dwell G04
What is ‘dwell’
It is a function to delay the execution of the next block.

P ______
Programming format G04
X _______

Example G04 P1000 ;


G04 X1000 ; Dwell of 1 second
G04 X1.0 ;
• G04 must be specified by one block by itself

28
Applications Engineering ASIA INDIA
Automatic Reference point return G28
Automatic reference point return is a function to return
each axis to its reference position automatically.

G91 / ( G90 ) G28 X__ Y__ Z__ ;

Example :-
• G91 G28 Z0 ; The tool moves rapidly to the reference point
of the Z axis ( machine zero point ).
• G28 is usually used under G91 & without axes motion ( X0, Y0 ).
• G28 causes rapid traverse regardless of the previous mode.
• Before specifying G28, the tool radius compensation should be
cancelled in advance.

29
Applications Engineering ASIA INDIA
Circle Interpolation G02 , G03
Circle Interpolation
• Commands G02, G03 are used to cut circle or
circular arcs. G02 is specified for CW circular motion.
G03 for CCW circular motion.

30
Applications Engineering ASIA INDIA
Dimension I & J
* Command I & J specify the distance from the start point of circle arc A
to the Center. I & J must be specified incrementally irrespective of ABS /
INC mode, adding plus or minus for the direction of I & J
* Dimensions I & J are the same data regardless of ABS or INC.
Y
B (end point of the arc)
Y
60
A (start point of the arc)
Start 40

center J
X 10
Center End 10 20 50 X J+
0,0 I
I- I+
ABS G90 G03 X20 Y60 I-40 J-30 F100 ; J-
INC G91 G03 X-30 Y20 I-40 J-30 F100 ;

31
Applications Engineering ASIA INDIA
Specifying radius of circle arc R
* The radius of circle arc can be directly specified by R instead of
specifying the center of circle arc by I, J & K.
* When the center angle of arc is 180 deg or more, the radius R
must be specified with negative (-) sign.
Y

Start

50
B (end point of the arc)

R
60 70
A (start point of the arc)
40
R30 20 End point

0,0 X 0,0 20 70
20 50
ABS G90 G03 X20 Y60 R30 F100 ABS G90 G02 X70 Y20 R-50 F100
INC G91 G03 X-30 Y20 R30 F100 INC G91 G02 X50 Y-50 R-50 F100

32
Applications Engineering ASIA INDIA
A complete circle
* With I, J & K a complete circle can be programmed by
using one block.
Y+ A

0
R4
B
J+
X+
I- I+

J-

From A point From B point


ABS G90 G02 J-40 F100 ABS G90 G02 I-40 F100
INC G91 G02 J-40 F100 INC G91 G02 I-40 F100

33
Applications Engineering ASIA INDIA
Example G02 & G03
Y
O0001 (ABS);

N1 G90 G54 G00 X-60.0Y-40.0S1000 M03; (0,60)


N3
N2 G01 Y0 F100;
N3 G02 X0 Y60.0 I60.0; (R60.0) R6 N4
0
N4 G01 X40.0Y0; (-60,0)
N5 G02 X0 Y-40.0 I-40.0; (R40.0) (40,0) X
N1

R4
N6 G01 X-60.0; N2

0
N7 G00 X0 Y0; N7 N5
N8 M30; N6
(-60,-40) (0,-40)

34
Applications Engineering ASIA INDIA
Tool Radius Compensation G41,G42 & G40
Tool Radius Compensation, rules of G41, G42
• This
.
function is used for side cutting by end mill,
from rough, semi - finish to finishing cutting.
• G40 for Canceling G41,G42.
Follow the cutting feed direction G42
G42 G41
G41 Left G41
G42 Right

G41 G40

G42 Canceling G42


G41

35
Applications Engineering ASIA INDIA
Programming Format G41,G42 & G40

Plane Selection Tool radius compensation Offset number

G17 X_ Y_
G00 G42 D_ ;
G18 Z_ X_
G01 G41
Y_ Z_
G19
X_ Y_
G00
Canceling G40 Z_ X_
G01
Y_ Z_

36
Applications Engineering ASIA INDIA
Function of G41
G41 Tool radius offset compensation - Left
• The center of the tool is offset by
the amount referring to the
advance direction.
• G41 cause down cut.

37
Applications Engineering ASIA INDIA
Function of G42
G42 Tool radius offset compensation - Right
• the center
. of the tool is offset by
the amount referring to the
advance direction.
• G42 cause up cut.

38
Applications Engineering ASIA INDIA
Advantage of Tool Radius Compensation
Simplification of roughing to finishing program
• Any allowance can be obtained by modifying the tool
offset data actually used from the tool dimension in
spite of the same program . OFFSET
NO DATA NO DATA
H16 0.000 H25 0.000
Finishing H17 0.000 H26 0.000
H18 0.000 H27 0.000
H19 0.000 H28 0.000
Semi-Finishing Roughing C = A+B H20 0.000 H29 0.000

Finishing C = A H21 0.000 H30 0.000


H22 0.000 H31 0.000
D32 = C value H23 0.000 H32 10.000
Roughing
ACTUAL POSITION [ RELATIVE ]
X 0.000 Y 0.000
C A
Z 0.000
B
[OFFSET] [SETTING] [WORK]

39
Applications Engineering ASIA INDIA
Sample of Program for G41, G42 & G40
OFFSET
O1000 (Ø20 ENDMILL ) ; NO DATA NO DATA
G90 G54 G00 X0 Y0 S1000 M03 ; H16 0.000 H25 0.000
H17 0.000 H26 0.000
G01 G41 X0 Y-50.0 D32 F100 ; H18 0.000 H27 0.000
X100.0 ; H19 0.000 H28 0.000
H20 0.000 H29 0.000
Y50.0 ; H21 0.000 H30 0.000
200
X-100.0 ; H22 0.000 H31 0.000
H23 0.000 H32 10.000
Y-50.0 ;
X0 ; ACTUAL POSITION [ RELATIVE ]
X 0.000 Y 0.000
G40 X0 Y0 ; 100 Z 0.000

M30 ; [OFFSET] [SETTING] [WORK]

40
Applications Engineering ASIA INDIA
Learning Activity
• If now we need to cut a hole is Ø20
OFFSET

with the tolerance of ± 0.05 NO DATA NO DATA


H16 0.000 H25 0.000

• Your offset D32 = 10.0 H17


H18
0.000
0.000
H26
H27
0.000
0.000
H19 0.000 H28 0.000
• After cutting a hole and measure the H20 0.000 H29 0.000
H21 0.000 H30 0.000

result is 19.5mm. H22


H23
0.000
0.000
H31
H32
0.000
10.000

• What is your answer to change the ACTUAL POSITION [ RELATIVE ]


X 0.000 Y 0.000

value of D32, “+” plus or “-” minus. Z 0.000

- 0.250
• Your Answer for D32 = __________ . [OFFSET] [SETTING] [WORK]

Updated Value of offset = 9.750


41
Applications Engineering ASIA INDIA
Summary for G41 & G42
• Under the offset mode ( after specifying G41 or G42),two
block are read in advance for offset calculation. Therefore
two or more blocks, other than the specified plane, must
not be programmed because it may cause over cutting.

• To prevent under or over cutting do it on 90° approach to
the surface.

• Canceling for G40 command


with X Y block together.
• Like G40 X10.0 Y10.0 ;
• Avoid G40 X10.0 ; or
• G40 Y10.0 ;
Approach with 90° Avoid this method
for approach

42
Applications Engineering ASIA INDIA
Canned Cycle
What is a ‘canned cycle’ ?
• The canned cycle can also be called the ‘hole drilling
cycle’.
• Several popular machining cycles such as boring,drilling
and tapping are specified with a fixed format which is
shortened and performed easily.

43
Applications Engineering ASIA INDIA
Programming Format for Canned Cycle
G90 G98 G_ _ X_Y_R_Z_Q_F_P_L_ ;
G91 G99

G98 : Initial Level return

G99 : Reference ( R point )


Level return

44
Applications Engineering ASIA INDIA
Programming Format for Canned Cycle
G 98 : Initial level return
G 99 : R point level return
G __ : Cycle mode ( G81, G82, G83 )
G80 : Canned cycle cancellation

X : Hole position of X Q : Depth of cut ( incremental data )


Y : Hole Position of Y F : Cutting Feedrate
Z : Hole bottom level P : Dwell Time
R : R point position

L : Repetitive times ( The number of times )

45
Applications Engineering ASIA INDIA
Overview of Canned cycles
Cycle feed Operation at the Retraction
G code ( - Z direction ) bottom of a hole ( + Z direction ) Application
High speed peck drilling
G73 Intermittent feed ---- Rapid traverse cycle
G74 Cutting feed Spindle CW Cutting feed Left hand tapping cycle
Fine boring cycle
G76 Cutting feed Spindle orientation Rapid traverse ( canned cycle II only )
G80 ---- ---- ---- Cancel
Drilling cycle, spot drilling
G81 Cutting feed ---- Rapid traverse cycle
Drilling cycle, counter
G82 Cutting feed Dwell Rapid traverse boring cycle
G83 Intermittent feed ---- Rapid traverse Peck drilling cycle
G84 Cutting feed Spindle CCW Cutting feed Tapping cycle
G85 Cutting feed ---- Cutting feed Boring cycle
G86 Cutting feed Spindle stop Rapid traverse Boring cycle
Manual / Boring cycle, back boring
G87 Cutting feed Spindle stop Rapid traverse cycle
Dwell Manual /
G88 Cutting feed Spindle stop Rapid traverse Boring cycle
G89 Cutting feed Dwell Cutting feed Boring cycle

46
Applications Engineering ASIA INDIA
Example of Program
G98 G81 G98 G82
FEED
RAPID

O O Initial point O O Initial point

O Point R O Point R

O O Point Z O O Point Z
Dwell

G98 / G99 G81 X_ Y_ R_ Z_ F_ ; G98 / G99 G81 X_ Y_ R_ Z_P_ F_ ;

47
Applications Engineering ASIA INDIA
Example of Program
G98 / G99 G81 X_ Y_ R_ Z_ F_ ;
O1000 ( CANNED CYCLE ) ;
G90 G54 G00 X0 Y0 ; 100 10
Y
S1000 M3 ;
Z100.0 ;
50 Z
G98 G81 X50.0 Y25.0 R5.0 Z-10.0 F100;
X-50.0 ;
Y-25.0 ; X
X50.0 ;
G80 ;
M30 ;

48
Applications Engineering ASIA INDIA
Difference between G73 & G83
G73 / G83 X_ Y_ R_ Z_ Q_ F_ L_ ;
G98 G73 G98 G83
FEED FEED
RAPID RAPID

O O Initial point O O Initial point

O O
R Point R Point
Q Q O
d d
O O O O

Q Q O
d O O
d
O O

Q Q
O O Point Z O O Point Z
G73 - HIGH SPEED PECK DRILLING CYCLE G83 - PECK DRILLING CYCLE

49
Applications Engineering ASIA INDIA
G76 Fine Boring Cycle
G98 / G99 G76 X_ Y_ R_ Z_ Q_ F_ ;
Tool

Initial point
O O O

FEED
O Point R RAPID

OSS O
Point Z
Q
OSS - oriented spindle stop M19 Shift amount Q

“Q” is shift amount. Direction of shift is controlled by parameter.

50
Applications Engineering ASIA INDIA
Programming Example
G98 G84 X_ Y_ R_ Z_ P_ F_ ; G98 G86 X_ Y_ R_ Z_ F_ ;
G99 G99

FEED
RAPID

Initial point OO Initial point


OO

Spindle CW O O Point R Spindle CW O Point R

O O Point Z O O Point Z

Spindle CCW
Spindle stop

51
Applications Engineering ASIA INDIA
Programming Format M98 ,M99 & M30

Method of subprogram call :-


• M98 P1001 L11 ;
Call Subprogram Number “P1001” and Repeat “L11” time.
Permissible range of ‘L’ is up to 9999 time.
When ‘L’ is omitted the program is repeated once.
• M99 ; ( End of Sub program )
• M30 ; ( End of Main Program )

52
Applications Engineering ASIA INDIA
Subprogram nesting up to 4 levels
Main program Sub program Sub program Sub program Sub program

01(Main) 010(Sub -1) 020(Sub -2) 030(Sub-3) 040(Sub-4)

M98 P10; M98 P20; M98 P30; M98 P40 ;

M 30 M 99 M 99 M 99 M 99

First second Third Fourth

53
Applications Engineering ASIA INDIA
Example of Subprogram
01001 (SUB PRO ) ;
Use F100 as feedrate G91 G00 Z-95.0 ;
50 ----- Rapid traverse G41 X40.0 Y20.0
___ Cutting feed D32;
G01 Z-15.0 F100;
Y30.0 ;
50 100 150
01000 ( MAIN PRO ); X-10.0;
G90 G54 G00 X0 Y0 ; X10.0 Y30.0 ;
S1000 M03 ; X40.0 ;
Z100.0 ; X10.0 Y-30.0 ;
X-10.0 ;
M98 P1001 ;
Y-20.0 ;
G90 G00 X80.0 ;
X-50.0 ;
M98 P1001 ;
G00 Z100.0 ;
G90 G00 X0 Y0 M05 ;
G40 X-30.0 Y-30.0 ;
M30;
M99 ;

54
Applications Engineering ASIA INDIA
Example of Subprogram under G90 mode
Y

50 O1000 ( MAIN PRO ); 01001 ( SUB PRO );


1 2 G90 G00 Z5.0 ;
G90 G54 G00 X0 Y0 ;
20
10
G41 X20.0 Y10.0
S1000 M03 ; D32;
X
10 20 50 60 70 100
Z100.0 ; G01 Z-10.0 F200;
G54 G55
M98 P1001 ; Y50.0 F100 ;

G90 G55 G00 X 0 Y0 ; X50.0;


Y20.0;
M98 P1001 ;
X10.0 ;
M05 ;
Z100.0 ;
M30; G40 X0 Y0 ;
Using two work
coordinates. M99 ;

55
Applications Engineering ASIA INDIA
56
Applications Engineering ASIA INDIA

You might also like