g & m codes - sharpschoolwbsdeast.sharpschool.net/userfiles/servers/server_2992254...what are g...
TRANSCRIPT
G & M Codes
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
What Are G & M Codes?
• Operate CNC machines
• Began in the form of punch tape
• Developed into computer chips in the 1970s
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
G & M Today
• Translates human language to machine language
• Typed into computer or generated by a program
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Sample Program Block
N1 M06 T1 ; Change to tool #1
Block Sequence #Miscellaneous code: Tool change
Tool Number
Comment
Comment separator
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Sample Program Block
N02 M03 S1500
Line Number
Miscellaneous code: Turn spindle on
Spindle Speed: 1500 rpm
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Sample Program Block
N03 G90 G01 X.5 Y.5 Z0 F1
Line NumberPrep Code – Absolute
Prep Code – SL Interpol
Y Coordinate
X Coordinate
Z CoordinateFeed Rate (in./min)
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
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
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
TerminologyWord – 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
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
G Codes – PreparatoryG90 Absolute CoordinatesG91 Relative CoordinatesG00 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
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
G Codes – Arcs
Absolute coordinatesExample
N0 G90 ; Absolute coordN5 G01 X1 Y2 ; startN10 G02 X2 Y1 I1 J1
X2Y1
Relative coordinatesExample
N0 G91; Relative coordN05 G01 X1 Y2 ; startN10 G02 X1 Y-1 I0 J-1
X1Y2
I1J1
X1Y-1
X1Y2
I0 J-1
Method 1: Arc with I and J(I and J are center point coordinates)
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
G Codes – Arcs
Absolute coordinatesExample
N0 G90 ; Absolute coordN5 G01 X1 Y2 ; startN10 G02 X2 Y1 R1
Relative coordinatesExample
N0 G91; Relative coordN05 G01 X1 Y2 ; startN10 G02 X1 Y-1 R1
X1Y-1
X1Y2
R1
X2Y1
X1Y2
R1
Method 2: Arc with R(R is arc radius)
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Other Common G Codes
G20 Inch programming unitsG21 Millimeter programming unitsG80 Canned cycle cancelG81 Drilling cycleG82 Drilling cycle with dwell
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
M Codes – MiscellaneousM00 Pause M01 Optional stopM02 End of programM03 Spindle onM05 Spindle offM06 Tool changeM08 / M09 Accessory # 1 on / offM10 / M11 Accessory # 2 on / offM30 Program end and resetM47 Rewind (used for handshaking operations)
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
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
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
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
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Sample Part – Absolute
A 0.5 0.5B 0.5 1.5C 0.875 1D 1.25 1.5E 1.25 0.5F 1.75 1.5H 1.75 0.5I 1.75 1
AbsoluteCoordinates
Origin
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Sample ProgramAbsolute
N0 G90 G20 ; ABSOLUTE COORD & INCH MODEN5 M06 T1 ; TOOL CHANGE – LOAD TOOL 1N10 M03 S3000 ; TURN SPINDLE ON CW TO 3000 RPMN15 G00 X.5 Y.5 ; RAPID TO POINT AN20 G00 Z.1 ; RAPID TO .1 ABOVE PARTN25 G01 Z-.0625 F9 ; PLUNGE 1/16 AT 9 IN./MINN30 G01 X.5 Y1.5 F18 ; STRAIGHT LINE INTERP TO BN35 G01 X.875 Y1 ; STRAIGNT LINE INTERP TO CN40 G01 X1.25 Y1.5 ; STRAIGHT LINE INTERP TO DN45 G01 X1.25 Y.5 ; STRAIGHT LINE INTERP TO E
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Sample ProgramAbsolute
N50 G01 Z.1 ; RETRACT CUTTING TOOLN55 G00 X1.75 Y1.5 ; RAPID TO POINT FN60 G01 Z-.0625 F9 ; PLUNGE AT 9 IN./MINN65 G01 X1.75 Y.5 F18 ; STRAIGHT LINE INTERP TO HN70 G03 X1.75 Y1.5 I1.75 J1 ; CCW CIRCLE INTERPN75 G01 Z.1 ; RETRACT CUTTING TOOLN80 M05 ; TURN OFF SPINDLEN85 G00 Z2 ; RAPID Z TO SAFE POSITIONN90 G00 X4 Y3 ; MOVE TABLE TO UNLOAD POSITIONN95 M02 ; END OF PROGRAM
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Sample Part – Incremental
LABEL X YA 0.5 0.5B 0 1C 0.375 -0.5D 0.375 0.5E 0 -1F 0 1H 0 -1I 0 0.5
IncrementalCoordinates
Origin
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Sample ProgramIncremental / Relative
N00 G90 G20 ; ABSOLUTE COORD & INCH MODEN5 M06 T1 ; TOOL CAHNGE – LOAD TOOL 1 N10 M03 S3000 ; TURN SPINDLE ON CW TO 3000 RPMN15 G00 X.5 Y.5 ; RAPID TO POINT AN20 G00 Z.1 ; RAPID TO .1 ABOVE POINT AN25 G91 ; INCREMENTAL COORD & INCH MODEN25 G01 Z-.1625 F9 ; PLUNGE 1/16 AT 9 IN./MINN30 G01 X0 Y1 F16 ; STRAIGHT LINE INTERP TO BN35 G01 X.375 Y-.5 ; STRAIGHT LINE INTERP TO CN40 G01 X.375 Y.5 ; STRAIGHT LINE INTERP TO DN45 G01 X0 Y-1 ; STRAIGHT LINE INTERP TO E
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
N50 G01 Z.1625 ; RETRACT CUTTING TOOLN55 G00 X.5 Y1 ; RAPID TO POINT FN60 G01 Z-.1625 F9 ; PLUNGE AT 9 IN./MINN65 G01 X0 Y-1 F16 ; STRAIGHT LINE INTERP TO HN70 G03 X0 Y1 I0 J.5 ; CCW CIRCLE INTERPN75 G01 Z.1625 ; RETRACT CUTTING TOOLN80 M05 ; TURN OFF SPINDLEN85 G90 ; CHANGE TO ABSOLUTE COORD N85 G00 Z2 ; RAPID Z TO SAFE POSITIONN90 G00 X4 Y3 ; MOVE TABLE TO UNLOAD POSITIONN95 M02 ; END OF PROGRAM
Sample ProgramIncremental / Relative
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Your Turn
What line in the last example uses the arc command?
N70Change the arc command in the last example into the format with R (radius).
N70 G03 X0 Y1 R.5 ; CCW CIRCLE INTERPSee next slide for change in program.
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
SolutionN50 G01 Z.1625 ; RETRACT CUTTING TOOLN55 G00 X.5 Y1 ; RAPID TO POINT FN60 G01 Z-.1625 F9 ; PLUNGE AT 9 IN./MINN65 G01 X0 Y-1 F16 ; STRAIGHT LINE INTERP TO HN70 G03 X0 Y1 R.5 ; CCW CIRCLE INTERPN75 G01 Z.1625 ; RETRACT CUTTING TOOLN80 M05 ; TURN OFF SPINDLEN85 G90 ; CHANGE TO ABSOLUTE COORD N85 G00 Z2 ; RAPID Z TO SAFE POSITIONN90 G00 X4 Y3 ; MOVE TABLE TO UNLOAD POSITIONN95 M02 ; END OF PROGRAM
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
Explain the Code
N2 G1 X2.5 Y3 F2
N2G1X2.5Y3F2
Block twoLinear interpolation
2.5 on the X axis
3 on the Y axis
Feed rate = 2 IPM
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
What’s Wrong with These?1. N1G01G90X2X2; 2. N1G00G01X2Y2; 3. N3G01X.5Y2F1;
N4G01X.5Y3.5F1;4. Changing N6G00X0.500Y1.500; to N6G0X.5Y1.5;5. Changing N2G90Z0.05M00; to N2G9Z.5M;
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)
ReferencesMattson, M. (2010). CNC programming principles and
applications. Oregon City, OR: Delmar.
You created this PDF from an application that is not licensed to print to novaPDF printer (http://www.novapdf.com)