Presentation is loading. Please wait.

Presentation is loading. Please wait.

G & M Codes Computer Integrated Manufacturing

Similar presentations


Presentation on theme: "G & M Codes Computer Integrated Manufacturing"— Presentation transcript:

1 G & M Codes Computer Integrated Manufacturing
© 2013 Project Lead The Way, Inc.

2 What Are G & M Codes? Operate CNC machines
Computer Integrated Manufacturing™ Product Development What Are G & M Codes? Operate CNC machines Began in the form of punch tape Developed into computer chips in the 1970s CNC means Computer Numerical Control, where electronic systems are used to perform machine movements. Project Lead The Way, Inc. Copyright 2008

3 G & M Today Translates human language to machine language
G & M Codes Computer Integrated Manufacturing™ Product Development G & M Today Translates human language to machine language Typed into computer or generated by a program The CNC is moved by a program and is usually written in G & M Codes. Just like any computer-driven mechanism, a CNC communicates using its own language. In order to communicate with the CNC, we must convert our language (turn this, move here) into one that the CNC will comprehend. Project Lead The Way, Inc. Copyright 2008

4 Sample Program Block N1 M06 T1 ; Change to tool #1 Comment
G & M Codes Computer Integrated Manufacturing™ Product Development Sample Program Block N1 M06 T1 ; Change to tool #1 Comment Comment separator Two types of instructions exist: Those which define the tool path (such as X and Y axis coordinates). Those which specify machine operations (such as turning the spindle on or off). X, Y, and Z are used to define the X, Y, and Z coordinates for the destination when cutting in a straight-line. I, J, and K are used to communicate to the tool the X, Y and Z coordinates of the center point of an arc (for circular interpolation). In absolute programming, I words represent the X coordinate, J words represent the Y coordinate, and K words represent the Z coordinate. In incremental programming, the I, J, and K words specify the distance from the start point to the center point of the arc. F is measured in inches per minute. S is measured in revolutions per minute (RPM). Comments must be made on the same line of programming as the semicolon. Tool Number Miscellaneous code: Tool change Block Sequence # Project Lead The Way, Inc. Copyright 2008

5 Sample Program Block N02 M03 S1500 Spindle Speed: 1500 rpm
G & M Codes Computer Integrated Manufacturing™ Product Development Sample Program Block N02 M03 S1500 Spindle Speed: 1500 rpm Two types of instructions exist: Those which define the tool path (such as X and Y axis coordinates). Those which specify machine operations (such as turning the spindle on or off). X, Y, and Z are used to define the X, Y, and Z coordinates for the destination when cutting in a straight-line. I, J, and K are used to communicate to the tool the X, Y and Z coordinates of the center point of an arc (for circular interpolation). In absolute programming, I words represent the X coordinate, J words represent the Y coordinate, and K words represent the Z coordinate. In incremental programming, the I, J, and K words specify the distance from the start point to the center point of the arc. F is measured in inches per minute. S is measured in revolutions per minute (RPM). Comments must be made on the same line of programming as the semicolon. Miscellaneous code: Turn spindle on Line Number Project Lead The Way, Inc. Copyright 2008

6 Sample Program Block N03 G90 G01 X.5 Y.5 Z0 F1 Feed Rate (in./min)
G & M Codes Computer Integrated Manufacturing™ Product Development Sample Program Block N03 G90 G01 X.5 Y.5 Z0 F1 Feed Rate (in./min) Z Coordinate Y Coordinate X Coordinate Two types of instructions exist: Those which define the tool path (such as X and Y axis coordinates). Those which specify machine operations (such as turning the spindle on or off). X, Y, and Z are used to define the X, Y, and Z coordinates for the destination when cutting in a straight-line. I, J, and K are used to communicate to the tool the X, Y and Z coordinates of the center point of an arc (for circular interpolation). In absolute programming, I words represent the X coordinate, J words represent the Y coordinate, and K words represent the Z coordinate. In incremental programming, the I, J, and K words specify the distance from the start point to the center point of the arc. F is measured in inches per minute. S is measured in revolutions per minute (RPM). Comments must be made on the same line of programming as the semicolon. Prep Code – SL Interpol Prep Code – Absolute Line Number Project Lead The Way, Inc. Copyright 2008

7 G & M Codes CIM Product Development More Terminology Address Character – A letter used in G & M code programming to designate a class of functions Parameter – Attribute of a feature, such as a dimension, that can be modified N00 G90 G01 X.5 Y.5 Z0 F1 Before we can look at an example, we need to learn the basic terminology associated with G & M codes. Project Lead The Way, Inc. Copyright 2010

8 G & M Codes Computer Integrated Manufacturing™ Product Development Terminology Word – The programming expression formed when a letter (address) is combined with a number Block – A single line of code in an NC part program N00 G90 G01 X.5 Y.5 Z0 F1 Before we can look at an example, we need to learn the basic terminology associated with G & M codes. Project Lead The Way, Inc. Copyright 2008

9 G Codes – Preparatory G90 Absolute Coordinates
G & M Codes Computer Integrated Manufacturing™ Product Development G Codes – Preparatory G90 Absolute Coordinates G91 Relative Coordinates G00 Rapid Traverse (non-cutting move) G01 Straight Line Interpolation (cutting move) G02 Circular Interpolation (clockwise) G03 Circular Interpolation (c-clockwise) G04 Dwell (wait) – Pause measured in seconds on all axes between motions (i.e., G04F2.3 is a pause for 2.3 s) G05 Pause – Wait for user intervention G codes are preparatory functions that involve actual tool movements that control the machine. These include rapid moves, linear feed moves, radial feed moves, etc. Most G codes are modal, meaning that they remain active until canceled by another G-code. The format of the G04 command can be found in a different format where P is used instead of F (i.e., G04P2.3 is a pause for 2.3 s). Project Lead The Way, Inc. Copyright 2008

10 G Codes – Arcs Method 1: Arc with I & J ( I & J are center point coordinates ) X1Y2 I1J1 Absolute coordinates Example N0 G90 ; Absolute coord N5 G01 X1 Y2 ; start N10 G02 X2 Y1 I1 J1 X2Y1 X1Y-1 X1Y2 I0 J-1 Relative coordinates Example N0 G91; Relative coord N05 G01 X1 Y2 ; start N10 G02 X1 Y-1 I0 J-1

11 G Codes – Arcs Method 2: Arc with R (R is arc radius)
Absolute coordinates Example N0 G90 ; Absolute coord N5 G01 X1 Y2 ; start N10 G02 X2 Y1 R1 X2Y1 X1Y2 R1 X1Y-1 X1Y2 R1 Relative coordinates Example N0 G91; Relative coord N05 G01 X1 Y2 ; start N10 G02 X1 Y-1 R1

12 Other Common G Codes G20 Inch programming units
G21 Millimeter programming units G80 Canned cycle cancel G81 Drilling cycle G82 Drilling cycle with dwell

13 M Codes – Miscellaneous
G & M Codes Computer Integrated Manufacturing™ Product Development M Codes – Miscellaneous M00 Pause M01 Optional stop M02 End of program M03 Spindle on M05 Spindle off M06 Tool change M08 / M09 Accessory # 1 on / off M10 / M11 Accessory # 2 on / off M30 Program end and reset M47 Rewind (used for handshaking operations) M codes are miscellaneous functions that include actions necessary for machining but are not actual tool movements. They are auxiliary functions, such as spindle on or off, tool changes, coolant on or off, and program stops. Project Lead The Way, Inc. Copyright 2008

14 Code Suggestions Same code not required to be repeated every block
G & M Codes Computer Integrated Manufacturing™ Product Development Code Suggestions Same code not required to be repeated every block Machine will use same code until changed Called modal Tab remarks away from code to facilitate troubleshooting program Specify absolute or relative coordinates and inch or metric modes at beginning of program Always use a tool change command to move tool to safe position away from material; change tool if necessary Indicate spindle speed each time turned on Project Lead The Way, Inc. Copyright 2008

15 Code Suggestions Move tool to start position in two lines
First line moves in X-Y plane, then moves in Z axis Prevents ramping or inadvertently cutting a part Raise tool out of the stock at end of program Always move table to safe unload position and turn spindle off at end of program Use M02 command to end program

16 Sample Part – Absolute Absolute Coordinates Origin G & M Codes
Computer Integrated Manufacturing™ Product Development Sample Part – Absolute Absolute Coordinates Origin In this example, you will notice that each line represents a quarter inch. Project Lead The Way, Inc. Copyright 2008

17 Sample Program Absolute
G & M Codes Computer Integrated Manufacturing™ Product Development Sample Program Absolute N1 G90 G20 ; ABSOLUTE COORD & INCH MODE N2 M06 T1 ; TOOL CHANGE – LOAD TOOL 1 N3 M03 S3000 ; TURN SPINDLE ON CW TO 3000 RPM N4 G00 X.5 Y.5 ; RAPID TO POINT A N5 G00 Z.1 ; RAPID TO .1 ABOVE PART N6 G01 Z F9 ; PLUNGE 1/16 AT 9 IN./MIN N7 G01 X.5 Y1.5 F18 ; STRAIGHT LINE INTERP TO B N8 G01 X.875 Y1 ; STRAIGNT LINE INTERP TO C N9 G01 X1.25 Y1.5 ; STRAIGHT LINE INTERP TO D N10 G01 X1.25 Y.5 ; STRAIGHT LINE INTERP TO E Characters following a semicolon are ignored by the machine. This space is used to add comments to the code. Comments are important in any programming to document the purpose of a line for the original programmer or for another person working with the program. Project Lead The Way, Inc. Copyright 2008

18 Sample Program Absolute
G & M Codes Computer Integrated Manufacturing™ Product Development Sample Program Absolute N11 G01 Z.1 ; RETRACT CUTTING TOOL N12 G00 X1.75 Y1.5 ; RAPID TO POINT F N13 G01 Z F9 ; PLUNGE AT 9 IN./MIN N14 G01 X1.75 Y.5 F18 ; STRAIGHT LINE INTERP TO H N15 G03 X1.75 Y1.5 I1.75 J1 ; CCW CIRCLE INTERP N16 G01 Z.1 ; RETRACT CUTTING TOOL N17 M05 ; TURN OFF SPINDLE N18 G00 Z2 ; RAPID Z TO SAFE POSITION N19 G00 X4 Y3 ; MOVE TABLE TO UNLOAD POSITION N20 M02 ; END OF PROGRAM Project Lead The Way, Inc. Copyright 2008

19 Sample Part – Incremental
G & M Codes Computer Integrated Manufacturing™ Product Development Sample Part – Incremental Incremental Coordinates Origin In this example, you will notice that each line represents a quarter inch. Project Lead The Way, Inc. Copyright 2008

20 Sample Program Incremental / Relative
G & M Codes Computer Integrated Manufacturing™ Product Development Sample Program Incremental / Relative N1 G90 G20   ; ABSOLUTE COORD & INCH MODE N2 M06 T1   ; TOOL CHANGE – LOAD TOOL 1 N3 M03 S3000 ; TURN SPINDLE ON CW TO 3000 RPM N4 G00 X.5 Y.5  ; RAPID TO POINT A N5 G00 Z.1  ; RAPID TO .1 ABOVE POINT A N6 G91  ; INCREMENTAL COORD & INCH MODE N7 G01 Z F9 ; PLUNGE 1/16 AT 9 IN./MIN N8 G01 X0 Y1 F16 ; STRAIGHT LINE INTERP TO B N9 G01 X.375 Y-.5 ; STRAIGHT LINE INTERP TO C N10 G01 X.375 Y.5 ; STRAIGHT LINE INTERP TO D N11 G01 X0 Y-1 ; STRAIGHT LINE INTERP TO E Characters following a semicolon are ignored by the machine. This space is used to add comments to the code. Comments are important in any programming to document the purpose of a line for the original programmer or for another person working with the program. Project Lead The Way, Inc. Copyright 2008

21 Sample Program Incremental / Relative
G & M Codes Computer Integrated Manufacturing™ Product Development Sample Program Incremental / Relative N12 G01 Z ; RETRACT CUTTING TOOL N13 G00 X.5 Y1 ; RAPID TO POINT F N14 G01 Z F9 ; PLUNGE AT 9 IN./MIN N15 G01 X0 Y-1 F16 ; STRAIGHT LINE INTERP TO H N16 G03 X0 Y1 I0 J.5 ; CCW CIRCLE INTERP N17 G01 Z ; RETRACT CUTTING TOOL N18 M05 ; TURN OFF SPINDLE N19 G90 ; CHANGE TO ABSOLUTE COORD N20 G00 Z2 ; RAPID Z TO SAFE POSITION N21 G00 X4 Y3 ; MOVE TABLE TO UNLOAD POSITION N22 M02 ; END OF PROGRAM Project Lead The Way, Inc. Copyright 2008

22 Your Turn What line in the last example uses the arc command? N16 Change the arc command in the last example into the format with R (radius). N16 G03 X0 Y1 R.5 ; CCW CIRCLE INTERP See next slide for change in program.

23 Solution N12 G01 Z.1625 ; RETRACT CUTTING TOOL
G & M Codes Computer Integrated Manufacturing™ Product Development Solution N12 G01 Z ; RETRACT CUTTING TOOL N13 G00 X.5 Y1 ; RAPID TO POINT F N14 G01 Z F9 ; PLUNGE AT 9 IN./MIN N15 G01 X0 Y-1 F16 ; STRAIGHT LINE INTERP TO H N16 G03 X0 Y1 R.5 ; CCW CIRCLE INTERP N17 G01 Z ; RETRACT CUTTING TOOL N18 M05 ; TURN OFF SPINDLE N19 G90 ; CHANGE TO ABSOLUTE COORD N20 G00 Z2 ; RAPID Z TO SAFE POSITION N21 G00 X4 Y3 ; MOVE TABLE TO UNLOAD POSITION N22 M02 ; END OF PROGRAM Project Lead The Way, Inc. Copyright 2008

24 Explain the Code N2 G1 X2.5 Y3 F2 N2G1X2.5Y3F2 Block two
G & M Codes Computer Integrated Manufacturing™ Product Development Explain the Code N2G1X2.5Y3F2 N2 G1 X2.5 Y3 F2 Block two Linear interpolation 2.5 on the X axis 3 on the Y axis Explain each word in the code. Feed rate = 2 IPM Project Lead The Way, Inc. Copyright 2008

25 What’s Wrong with These?
G & M Codes Computer Integrated Manufacturing™ Product Development What’s Wrong with These? N1G01G90X2X2; N1G00G01X2Y2; N3G01X.5Y2F1; N4G01X.5Y3.5F1; Changing N6G00X0.500Y1.500; to N6G0X.5Y1.5; Changing N2G90Z0.05M00; to N2G9Z.5M; This example includes two X codes. The use of two G codes, however, is correct, because one G code is from the Interpolation Group and the other is from the Programming Mode Group. This example uses two G codes from the same group. This example is not really wrong, it is just unnecessary. You do not have to repeat the feed rate, linear interpolation, and X value code in the line N4 because they remain the same. There is nothing wrong with this example. It is OK to take out extra zeroes. There is no such thing as a G9; the Z value has changed from .05 to .5, and the M address character has been left without a parameter. Project Lead The Way, Inc. Copyright 2008

26 References Mattson, M. (2010). CNC programming principles and applications. Oregon City, OR: Delmar.


Download ppt "G & M Codes Computer Integrated Manufacturing"

Similar presentations


Ads by Google