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

Basic Programming Jan 2013

The document provides an overview of basic CNC programming concepts including machine axes, address codes, absolute and incremental positioning, common G codes for axes movement, references, tool compensation and canned cycles. It also provides examples of rapid traverse, linear interpolation, and circle interpolation programming.

Uploaded by

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

Basic Programming Jan 2013

The document provides an overview of basic CNC programming concepts including machine axes, address codes, absolute and incremental positioning, common G codes for axes movement, references, tool compensation and canned cycles. It also provides examples of rapid traverse, linear interpolation, and circle interpolation programming.

Uploaded by

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

Welcome To Haas Automation

Customer Training JAN 2013


Basic Programming

Fundamentals of CNC Programming


for Machining Centers
Understanding of Machine Axes

Y+

X- X+

From Drawing Y-

3
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.

4
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

5
Program number O & Comment
Function of program number O
%
O10000 ( HAAS)
• O xxxxx 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 )

6
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 N2 M30

7
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

8
Absolute G90
Function G90
• Thedestination 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 ;

9
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 ;

10
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

11
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.

12
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

13
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
G76 : Fine Boring Cycle
G80 : Canned Cycle Cancellation
G81 : Drilling Cycle
G82 : Counter Boring Cycle
G83 : Peck Drilling Cycle
G84 : Tapping Cycle
G85 : Boring Cycle
G86 : Boring Cycle

14
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

15
es GC
d Fo
C o es r C odes
G r Ax Cy anne
Fo otion cle d
M s

G Code
o d e s Groups G Co
GC des F
To ol or
For s Com
r en ce pens
ation
Ref e

One Shot G
Codes


16
G CODES FOR AXES MOVEMENTS

G00 :Rapid positioning


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

17
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

18
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

19
What is a “CANNED CYCLE”

G Code 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

20
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

21
Sample of Program
O1000 ( HAAS )
N1 G90 G54 G00 X0 Y0 S1000 M3 ; 200

N2 G01 X0 Y-50.0 F100 ;


N3 X100.0 ;
N4 Y50.0 ; 100
N5 X-100.0 ;
N6 Y-50.0 ;
N7 X0 ; Y+

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

22
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.

23
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
* I & J are the distance of center from the starting point in X & Y directions.
* 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 50 X J+
0,0 10 20 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 ;

24
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

25
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 I0 J-40 F100 ABS G90 G02 I-40 J0 F100
INC G91 G02 I0 J-40 F100 INC G91 G02 I-40 J0 F100

26
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)

27
Tool Length Compensation

If Z Axis is Positioned Without If Z Axis is Positioned With Tool


Tool Length Compensation Length Compensation

28
Overview of Tool Length Compensation

29
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

30
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_

31
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.

32
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.

33
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]

34
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]

35
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

36
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

37
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

38
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.

39
Second reference point G30

Second or Third .. Reference Point is used by Machine tool builder for


Tool changing or Pallet changing.

Format: G91 G30 X0 Y0 Z0 P_;

P2 : Second Reference Point


P3 : Third Reference Point

Example: G91 G30 X0 Y0 Z0 P3;


Machine Axes will move to Third reference point.

Position of Second and Third reference point will be set by Parameters.

40
Data Setting G10
Data Setting is automatic loading of Work/Tool offset data.

Format: G90 G10 L_ P_R_ X_ Y_ Z_;

L : Data Type L1 for Tool data; L2 for Work data

P : Data No. P1…P99 incase of Tool data


P1(G54)…P6(G59) incase of Work data.

Ex: G90 G10 L1 P16 R125.0 (in Tool table data no. 16 will loaded by value 125.0)
G91 G10 L1 P16 R0.5 (In Tool table data no.16 will be increased by 0.5)

G90 G10 L2 P3 X200. Y200. Z200.(In work offset no.3 (G56) X200,Y200
& Z200 will be loaded.)

G91 G10 L2 P3 X0.1 Y0.1 Z0.1 (In G56 X,Y & Z values will increase by 0.1

41
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.

42
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

43
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 or Shift amount
Z : Hole bottom level F : Cutting Feedrate
R : R point position P : Dwell Time

L : Repetitive times ( The number of times )

44
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

45
Drilling Cycle -G81 & G82
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_ ;

46
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 ;

47
Deep Drilling Cycle - 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

48
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.

49
Boring Cycle G86
G98 G86 X_ Y_ R_ Z_ F_ ;
G99

OO Initial point

Spindle CW O Point R

O O Point Z

Spindle stop

50
Tapping Cycle G84
G98 G84 X_ Y_ R_ Z_ F_ ;
G99

FEED
RAPID

O Initial point

Spindle CW Point R

Point Z

Spindle CCW

51
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.

52
M05 Spindle rotation stop.
The main spindle stops rotating.

M06 Tool Change

M08 Coolant on
Flood coolant is supplied.

M09 Coolant off


M08 is cancelled.

M30 Program end (This shows the end of main program.)

M60 Pallet Change

M98 Subprogram call


M99 Subprogram end (This command shows the end of the subprogram)

53
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
When ‘L’ is omitted the program is executed once.
• M99 ; ( End of Sub program )
• M30 ; ( End of Main Program )

54
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

55
Example of Subprogram under G91 Mode
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-5.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-40.0 Y-30.0 ;
M30;
M99 ;

56
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 ;

 57
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.

58
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

59
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

60
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

61
62

You might also like