Вы находитесь на странице: 1из 20

ME 1355 CAD/CAM LABORATORY CNC MILLING PROGRAM Ex.No.

.1 Study of G Codes and M Codes to Write Manual Part Programming for Fanuc Control Systems PREPARATORY FUNCTION ( G CODES ) The preparatory functions are the commands, which prepare the machine for different modes of movement like contouring, thread cutting, positioning, peck drilling etc. These functions are also called as G codes. G codes are used as machining commands. MISCELLANEOUS FUNCTION ( M CODES ) The miscellaneous functions are the commands describing miscellaneous functions like subprogram call or exit., spindle clockwise or counter clockwise, coolant ON/ OFF, program end etc. these functions are also called as M codes. M codes are used as machine control commands. SUBROUTINES Subroutines or subprograms are mini programs similar to macros but are used in manual part programming. It can be defined as a set of instructions that can be activated and used for repetitive applications in the main program. In Fanuc control systems, subprograms are written as separate programs with specific subprogram names. When a subprogram name is called in the main program, the set of instructions in the subprogram is executed. After execution of the program flow returns to the main program at a point immediately after the original call point. CANNED CYCLE Canned cycles are built-in- functions that are available to perform specific tasks like thread cutting, grooving, pattern repeating, pocketing etc. A canned cycle simplifies the program using one or two blocks with specific G codes to specify the machining operations, instead of using several blocks.

Examples are
G71 G73 G75 G76 G170, G171 G172, G173 Multiple turning cycle Pattern turning cycle Grooving cycle Multiple thread cutting cycle Rectangular pocketing Circular pocketing

The list of G codes and M codes that can be used in milling machines are given below. M CODES
M00 M01 M02 M03 M04 M05 M06 M08 M09 M10 M11 M13 M14 M30 M70 M71 M80 M81 M98 M99 PROGRAM STOP OPTIONAL STOP PROGRAM STOP SPINDLE CLOCKWISE ROTATION SPINDLE ANTI-CLOCKWISE ROTATION SPINDLE STOP TOOL CHANGE COOLANT ON COOLANT OFF VICE ON VICE OFF COOLANT, SPINDLE CW COOLANT, SPINDLE CCW PROGRAM STOP AND REWIND X MIRROR ON Y MIRROR ON X MIRROR OFF Y MIRROR OFF SUBPROGRAM CALL SUBPROGRAM OFF/EXIT

FUNCTION

G CODE
G00 G01 G02 G03 G04 G20 G21 G28 G40 G41 G42 G43 G44 G49 G73 G74 G76 G80 G81 G82 G83 G84 G85 G90 G91 G92 G94 G95

FUNCTION
RAPID POSITIONING LINEAR INTERPOLATION CIRCULAR INTERPOLATION CW CIRCULAR INTERPOLATION CCW DWELL INPUT IN INCH INPUT IN MM RETURN TO REFERENCE POINT CUTTER COMPENSATION CANCEL CUTTER COMPENSATION LEFT CUTTER COMPENSATION RIGHT TOOL LENGTH COMPENSATION ( + ) TOOL LENGTH COMPENSATION ( - ) TOOL LENGTH COMPENSATION CANCEL PECK DRILLING CYCLE COUNTER TAPPING CYCLE FINE BORING CYCLE CANNED CYCLE CANCEL DRILLING CYCLE, SPOT BORING DRILLING CYCLE, COUNTER BORING PECK DRILLING CYCLE TAPPING CYCLE BORING CYCLE ABSOLUTE COMMAND INCREMENTAL COMMAND PROGRAMMING OF ABSOLUTE ZERO POINT FEED PER MINUTE FEED PER REVOLUTION

A list of G codes and M codes that can be used in lathes are given below.

M CODES
M00 M01 M02 M03 M04 M05 M06 M08 M09 M10 M11 M30 M98 M99 PROGRAM STOP OPTIONAL STOP PROGRAM END

FUNCTION

SPINDLE CLOCKWISE SPINDLE COUNTER CLOCKWISE SPINDLE STOP TOOL CHANGE COOLANT ON COOLANT OFF VICE OPEN VICE CLOSE PROGRAM END AND REWIND SUBPROGRAM CALL SUBPROGRAM EXIT

G CODES G00 G01 G02 G03 G04 G20 G21 G28 G32 G40 G41 G42 G50 G70 G71 G72 G73 G74 G75 G76 G90 G94 G98 G99

FUNCTION RAPID POSITIONING LINEAR INTERPOLATION CIRCULR INTERPOLATION CW CIRCULAR INTERPOLATION CCW DWELL INPUT IN inch INPUT IN mm REFERENCE POINT RETURN THREAD CUTTING TOOL NOSE RADIUS COMPENSATION CANCEL TOOL NOSE RADIUS COMPENSATION LEFT TOOL NOSE RADIUS COMPENSATION RIGHT SPINDLE SPEED CLAMPING FINISHING CYCLE MULTIPLE TURNING CYCLE MULTIPLE REPEATING CYCLE PATTERN REPEATING CYCLE PECK DRILLING CYCLE GROOVING CYCLE THREAD CUTTING CYCLE BOX TURNING CYCLE BOX FACING CYCLE FEED PER MINUTE FEED PER REVOLUTION

LINEAR INTERPOLATION AND CIRCULAR INTERPOLATION Ex.No.2 Write a manual part program for the given diagram using Linear interpolation and circular interpolation

O2000 [BILLET X100 Y100 Z10; [TOOLDEF T1 D5; [EDGEMOVE X0 Y0; N10 G21 G40 G94; N20 G50 S2000; N30 G91 G28 Z0; N40 G28 X0 Y0; N50 M06 T0101; N60 M03 S1000; N70 G90; N80 G00 X20 Y20 Z1; N90 G01 X20 Y20 Z-1 F35; N100 G01 X60 Y20 Z-1 F35; N110 G03 X80 Y40 Z-1 R20 F35; N120 G01 X80 Y60 Z-1 F35; N130 G02 X60 Y80 Z-1 R20 F35; N140 G01 X40 Y80 Z-1 F35; N150 G03 X20 Y60 Z-1 R20 F35; N160 G01 X20 Y20 Z-1 F35; N170 G00 Z1; N180 G91 G28 Z0; N190 G28 X0 Y0; N200 M05; N210 M30;

The same program can also be written as given below. EXAMPLE PROGRAM 2 FOR MILLING OPERATION O2001 [BILLET X100 Y100 Z10; [TOOLDEF T1 D5; [EDGEMOVE X0 Y0; N10 G21 G40 G94; N20 G50 S2000; N30 G91 G28 Z0; N40 G28 X0 Y0; N50 M06 T0101; N60 M03 S1000; N70 G90; N80 G00 X20 Y20 Z1; N90 G01 Z-1 F35; N100 X60 ; N110 G03 X80 Y40 R20; N120 G01 Y60; N130 G02 X60 Y80 R20; N140 G01 X40; N150 G03 X20 Y60 R20; N160 G01 Y20; N170 G91 G28 Z2; N180 G28 X0 Y0; N190 M05; N200 M30;

CIRCULAR POCKETING AND RECTANGULAR POCKETING Ex.No.3 Write a CNC program for milling machine for the profile given using circular pocketing and rectangular pocketing.

The syntax for circular pocketing is given below.


G170 R0 P0 Q3 X10 Y10 Z - 5 I0 J0 K24 G171 P75 S1000 R50 F45 B1500 J15 R Position of tool to start cycle

P
Q

Roughing (0) / finishing (1)


Peck increment for each cut

X,Y & Z
I&J K P S R F B J

Coordinates of bottom center of the circular pocket.


Finishing allowance for side and pocket base Radius of circular pocket Cutter movement percentage for next step Roughing spindle speed Roughing feed in Z direction Roughing feed in XY directions Finishing spindle speed Finishing feed

The syntax for rectangular pocketing is given below: G172 I30 J50 K0 P0 Q.5 R0 X10 Y10 Z-5 G173 I0 K0 P75 T1 S1000 R35 F45 B1500 J15 Z5 Where I,J K Length of pocket in X, Y directions Corner radius

P
Q R X&Y Z I,K P T S R F B J

Roughing (0) / Finishing (1)


Depth of cut for each pass Absolute depth from the surface Pocket corner coordinates Base of pocket Pocket side and base finish allowance Cutter width percentage Tool number Roughing spindle speed Roughing feed in Z direction Roughing feed in XY directions Finishing spindle speed Finishing feed

O2002; [BILLET X100 Y100 Z10; [TOOLDEF T1 D5; [EDGEMOVE X0 Y0; N10 G21 G40 G94; N20 G91 G28 Z0; N30 G28 X0 Y0; N40 M06 T0101; N50 M03 S2000; N60 G90 G00 X30 Y10 Z5; N70 G01 Z-1 F35; N80 X30 Y30; N90 X10 Y30; N100 X10 Y40; N110 G03 X10 Y60 R10; N120 G01 X10 Y70; N130 X30 Y70; N140 X30 Y90; N150 X40 Y90; N160 G03 X60 Y90 R10; N170 G01 X70 Y90; N180 X70 Y70; N190 X90 Y70; N200 X90 Y60; N210 G03 X90 Y40 R10; N220 G01 X90 Y30; N230 X70 Y30;

N240 X70 Y10; N250 X60 Y10; N260 G03 X40 Y10 R10; N270 G02 X30 Y10; N280 G00 Z5; N290 G172 I30 J30 K0 P0 Q0.5 R0 X35 Y35 Z-1.5; N300 G173 I0 K0 P75 T1 S2000 R75 F275 B2500 J200 Z6; N310 G170 P0 Q0.5 R1 X50 Y50 Z-3 I0 J0 K10; N320 G171 P75 S2000 R50 F150 B1500 J150; N330 G91 G28 X0 Y0 Z0; N340 M05; N350 M30;

CNC PROGRAM USING SUBPROGRAM Ex.No.4 Write a CNC program for milling machine for the profile given using sub program.

Profile depth = 5 mm

SUBPROGRAM

O9000;
N10 G91 G01 Z-1 F35; N20 G90; N30 G01 X40 Y20; N40 G02 X60 Y20 R10; N50 G01 X80 Y20; N60 X80 Y50; N70 G03 X20 Y50 R30; N80 G01 X20 Y20; N90 M99; ** save the subprogram as 4 digit number 9000.

Main Program O2003 [BILLET X100 Y100 Z20; [EDGEMOVE X0 Y0; [TOOLDEF T1 D5; N10 G21 G94 G40; N20 G91 G28 Z0; N30 G28 X0 Y0; N40 M06 T0101; N50 M03 S1000; N60 G90 G00 X20 Y20 Z1; N70 G01 Z0 F35; N80 M98 P0059000; N90 G01 Z1; N100 G91 G28 Z0; N110 G28 X0 Y0; N120 M05; N130 M30; The statement M98 P0059000 can be explained as follows: M 98 For subprogram call. P0059000 005 is the number of times the subprogram 9000 has to be called. (i.e. the subprogram 9000 has to be executed for 5 times.)

MIRRORING USING SUBPROGRAM Ex.No.5 Write a CNC program for milling machine for the profile given using sub program and mirror command.

Subprogram O8000; N10 G90 G00 X10 Y10 Z1; N20 G01 Z-1 F35; N30 G01 X30 Y10; N40 G03 X10 Y30; N50 G01 X10 Y10; N60 G00 Z1; N70 G00 X0 Y0; N80 M99;

** save the file as 4 digit number 8000. Main Program O2004 [BILLET X100 Y100 Z10; [EDGEMOVE X-50 Y-50; [TOOLDEF T1 D5; N10 G21 G94 G40; N20 G91 G28 Z0; N30 G28 X0 Y0;

N40 M06 T0101; N50 M03 S1000; N60 G90 G00 X0 Y0 Z5; N70 M98 P0018000; N80 M70; N90 M98 P0018000; N100 M71; N110 M98 P0018000; N120 M80; N130 M98 P0018000; N140 M81; N150 G91 G28 Z0; N160 G28 X0 Y0; N170 M05; N180 M30; PROFILE 1 X Mirror On PROFILE 4 Y Mirror On PROFILE 3 X Mirror Off PROFILE 2 Y Mirror Off

CNC PROGRAM USING DRILLING CYCLE Ex.No.6 Write a CNC program for milling machine as shown in diagram using drilling cycle.

O2005; [BILLET X100 Y100 Z20; [TOOLDEF T1 D10; [EDGEMOVE X-50 Y-50; N10 G21 G94 G41; N20 G91 G28 Z0; N30 G28 X0 Y0; N40 M06 T0101; N50 M03 S1000; N60 G90 G00 X0 Y0 Z5; N70 G83 X0 Y25 Z-10 Q0.5 R1 F35; N80 X21.65 Y12.5; N90 X21.65 Y-12.5 N100 X0 Y-25; N110 X-21.65 Y - 12.5; N120 X-21.65 Y 12.5; N130 G80; N140 G91 G28 Z0; N150 G28 X0 Y0; N160 M05; N170 M30; ; DRILL 1 DRILL 2 DRILL 3 DRILL 4 DRILL 5 DRILL 6

CNC PROGRAM USING FAST DRILLING CYCLE Ex.No.7 Write a CNC program for milling machine as shown in diagram using fast peck drilling cycle.

O2006 [BILLET X100 Y100 Z20; [TOOLDEF T1 D10; [EDGEMOVE XO YO; N10 G21 G94 G41; N20 G91 G28 Z0; N30 G28 X0 Y0; N40 M06 T0101; N50 M03 S1000; N60 G90 G00 X15 Y80 Z5; N70 G01 Z0; N80 G91 G73 X10 Y0 Z-5 Q0.5 R0.0 K5 F35; N90 G90; N100 G00 X25 Y80 Z0; N110 G91 G73 X15 Y-15 Z-5 Q0.5 R0.0 K4 F35; N120 G91 G28 Z0; N130 G28 X0 Y0; N140 M05; N150 M30;

Explanation Statement N20:G73- Peck drilling X10, Y10 denotes the incremental distance from its present position ( Present position is defined in N10) Z-5 denotes the depth of the drill Q0.5 denotes the depth of cut for each peck K5 denotes that drilling has to be done five times at the given increment R - denotes the position of tool to start in Z direction The block N20 drills five holes. Initially the tool is positioned at X15 and Y80 in block N10. From this position the tool takes a move of 10mm in X direction, which is point 1 and starts drilling. Then it moves to point 2 and starts drilling. So on, five drills at points 1,2,3,4 & 5 are drilled. After that, the tool is positioned at point 1. Then as per instructions in the block N30, the tool moves 15mm in X direction and 15mm in Y direction, which is point 6 and starts drilling. It moves to points 7,8 & 9 and performs drilling operation at each point as explained above. X & Y distances

Вам также может понравиться