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

CNC Codes and Letters

NOTE: The following will be a listing and description of Computer Numerical Control (CNC) Codes and Letter designations. We will try to stick with only generic codes that will work on most machines. Some examples may be specifically for the machines we have at South Adams / Area 18 Machine Trades. Please contact the instructor if you find any errors, missing items, or anything you would like to see added. jdailey@southadams.k12.in.us

Code G00 G01 G02 G03 G04 G17 G18 G19 G20 G21 G28 G40 G41 G42 G43 G44 Positioning (Rapid Traverse) Linear Interpolation (Feed) Circular Interpolation CW Circular Interpolation CCW Dwell X,Y Plane of Interpolation X,Z Plane of Interpolation Y,Z Plane of Interpolation Input in Inch Input in MM

Meaning

Letter A B C D E F G H I J K L M N O P P P Q Q R R S T U V W X Y Z

Meaning Rotary indexing axis around the "X" axis Rotary indexing axis around the "Y" axis Rotary indexing axis around the "Z" axis Cutter Radius / Diameter offset number Feedrate in inches per revolution (Lathe) Feedrate in inches per minute (can be used on lathes) Preparatory commands Offset Number (Mill - tool length)(Lathe - Position offset) Arc center location in the "X" axis Arc center location in the "Y" axis Arc center location in the "Z" axis Fixed Cycle repetion count / subprogram repetition count Miscellaneous function Block / Sequence number Program Number Subprogram / Macro Number call Dwell time in milliseconds Block number in main program when used with M99 Depth of peck in fixed cycles (G73and G83) Shift amount in fixed cycle (G76 and G87) Retract point in fixed cycles Arc Radius designation Spindle speed in RPMs Tool function Incremental move in "X" axis Incremental move in "Y" axis Incremental move in "Z" axis "X" axis coordinate value designation "Y" axis coordinate value designation "Z" axis coordinate value designation

Return to Machine zero (reference point) Cutter Compensation cancel Cutter Compensation left Cutter Compensation right Tool length compensation + Tool length compensation -

G54-G59 Set Local Coordinate Systems (Datum Shifts) G80 G81 G82 G83 G85 G90 G91 G92 G94 G95 M00 M01 M02 M03 M04 M05 M06 M08 M09 M30 M98 M99 Canned Cycle cancel Spot Drilling Cycle (no dwell) Drill/Counterbore (with dwell) Peck Drilling Cycle Bore Absolute Programming Incremental Programming Set Program Zero IPM Programming IPR Programming Program stop Optional stop End of Program Start Spindle (Clockwise) Start Spindle (Counterclockwise) Spindle off Tool change Coolant on Coolant off Program reset/tape rewind Sub-Program call Return to previous program

You should already have a list of G&M Codes and CNC Letters as shown. If you do not have one, see your instructor, or download one off of the South Adams / Area 18 Machine Trades

G Codes
- G Codes are known as Preparatory Commands which means they are preparing the CNC machine to do something. - Normally there should only be one G code per line, one exception is in the Safety Line at the beginning of the program. - G Codes are to be at the start of the Block of Program. Safety Line Example: G17 G20 G40 G80 G90

G00 Positioning Rapid Traverse


-First of all notice that it is G Zero Zero all of the G&M Codes use Zero and not the letter O. -G00 means the tool is going to move from where ever it currently is to the next position in a straight line as fast as the machine will go. - Think of G00 as a dragster, something that will go from point A to point B in a straight line as fast as possible Example: G00 X2.00 Y3.00

G01 Linear Interpolation


- G01 means the tool is going to move from where ever it currently is to the next position in a straight line but this time with a given feedrate. - Think of G01 as a truck driving on highway 218 or 124 through Adams County, Indiana, these highways are straight AND they have a speed limit. - On Milling Machines, the feedrate will typically be in IPM (inches per minute) and labeled with an F. -On Turning Machines, the feedrate will typically be in IPR (inches per revolution) and labeled with an E or F

Example: G01 X2.00 Y3.00 F6.00

G02 Circular Interpolation (CW)


-G02 Used anytime you need an arc in the Clockwise direction. - As with any Interpolation (machine movement), the machine already knows where it is, you only need to tell it where you want to go next. -For example: if you are setting at X0,Y0 and you want to put a 1.00 radius to X1.00, Y1.00 the Block would look like one of the following: G02 X1.00 Y1.00 R1.00 F12.0 G02 X1.00 Y1.00 I1.00 J0 F12.0

G03 Circular Interpolation (CCW)


-Just like with the G02 preparatory command, the G03 will move from point A to Point B only this time in a Counter Clockwise direction. - The Block of code will look identical to the code for G02 only the code will change. G03 X1.00 Y1.00 R1.00 F12.0 G03 X1.00 Y1.00 I1.00 J0 F12.0
- Always keep an eye on the details, the difference between G02 and G03 would be devastating if you wanted one and entered the other into a program!

CNC Vocab pit stop


- Modal [mohd-l]
- A Command that is to remain in a certain mode until canceled by another mode - In other words: it keeps going and going and going and going.. Until it is told to stop later in the program

- Antonym = Non-modal

-G04 is used anytime you want to pause or dwell at a position - A common Block when Dwell is required would be G04 P500
-The G04 of course specifies Dwell -The P500 states that it will be for 500 milliseconds

G04 Dwell

- Note: 1 Second equals 1000 milliseconds


- Therefore if you need to pause for 4.5 seconds you would program the Block as: G04 P4500

Example: G04 P1000

G17 X,Y Plane of Interpolation


-G17 is the most common plane to choose for a vertical machining center. -G17 will normally be one of if not THE first G code in a program. - The reason the G17 is so popular is that it could also refer to the table in front of you, the X axis is right and left movements while the Y axis would be towards and away from you

G18 X,Z Plane of Interpolation


-G18 could best be described as a normal engine lathe because the Z axis is the longitudinal travel of the lathe and the X axis would be your cross slide. - On a vertical machining center, this plane would be like looking at the screen of the controller since the X axis is right and left and the Z axis is up and down.

G19 Y,Z Plane of Interpolation


-On a Vertical milling machine, this would be the plane parallel to the side of the machine. - Once again, just think it through, the Y axis is towards and away from you and the Z axis is up and down.

G20 Inch Input


-G20 will typically be at the beginning of the program, that way the CNC knows right away that every dimension entered will be Inch and not metric. - G20 is very important to enter into each program you want to be inch, imagine if the program that ran prior to yours was a metric program and you do not switch it to inch, every dimension you enter will be read by the CNC as metric. OPPS!

G21 Metric Input


-Many shops have switched over to total metric, so G21 is becoming more popular in this area. - How you program using G21 is identical to G20 the only difference is you are entering Metric dimensions instead of Inch.

G28 Return to Machine Zero


-AKA: Return to Reference Point - G28 can be very handy, On a Vertical Machining Center anytime you want the tool as far away from the part vertically as possible you would enter G28 G91 Z0. If you want the part to come as close to you as possible for easy part changing you would enter G28 Y0 -Example: G28 G91 X0 Y0 Z0 Would bring the machine as fast as it can to its home position

G40 Cutter Compensation Cancel


-Typically found in the Safety Line of the program - Just like the description implies, G40 is used to cancel any cutter compensations whether it is for length (or height) compensation or Diameter Compensation. - Keep in mind that the person operating the machine prior to you could have done something with cutter compensation totally legal BUT different than what you need, cutter compensation cancel will clear everything out and be ready for you to add.

G41 Cutter Compensation Left


-Cutter compensation is used to program a part exactly to size using the dimensions provided on the print. THEN at the machine, offset that geometry to compensate for the tool you are using - Imagine climb milling around the outside of this picture the cutter would be rotating clockwise and moving around the picture clockwise, now guess which side of the part the cutter is. Your right, the LEFT side!

G42 Cutter Compensation Right


- Just like the G41 compensation only the opposite. Imagine conventional milling the same outside of this picture, the cutter is still spinning clockwise but this time the cutter is traveling counterclockwise around the outside of the part. NOW which side of the part is the cutter traveling on? You are right the Right side!

G43 Tool Length Compensation +


- Tool length compensation allows a machine to adjust for the different lengths of the tools. - Basically it is telling the machine how far it is from its Z home position to the position when the part touches the Z origin of the part. - The H value will be Added (+) to programmed Z position Example: G43 Z1.0 H01

G44 Tool Length Compensation - Tool length compensation allows a machine to adjust for the different lengths of the tools. - Basically it is telling the machine how far it is from its Z home position to the position when the part touches the Z origin of the part. - The H value will be Subtracted (-) from the programmed Z position Example: G44 Z1.0 H01

G54-G59 Work Offsets


- AKA: Datum Shifts - AKA: Set Local Coordinate Systems - Specifies the distance the machine would need to move from its home position to the origin of the part or fixture. - Used mostly when multiple parts / fixtures / Set-ups are on the same table Example: G55 G90 G00 X0.000 Y0.000

G80 Canned Cycle Cancel


- AKA: Fixed Cycle Cancel - Clears out any Modal Canned or Fixed cycles used earlier in a program - Used in the Safety Line to insure that what someone else did before does not affect what you will be doing in your program

Example: G82 X2.00 Y3.00 R.100 Z-.500 F6.0 G80

G81 Spot Drill Cycle (no dwell)


- Specifies that you want to drill to a given depth - Along with the G81 you will also need to specify the following:
Hole Position R-Plane Z Depth Feedrate

Example: G81 X2.00 Y3.00 R.100 Z-.250 F6.0

G82 Spot Drill Cycle (dwell)


- Specifies that you want to drill to a given depth - Along with the G82 you will also need to specify the following:
Hole Position R-Plane Z Depth Feedrate Dwell time

Example: G82 X2.00 Y3.00 R.100 Z-.250 F6.0 P500

G83 Peck Drill Cycle


- Specifies that you want to drill to a given depth - Along with the G83 you will also need to specify the following:
Hole Position R-Plane Z Depth Feedrate Peck Increment

Example: G83 X2.00 Y3.00 Z-1.500 R.100 Q.250 F6.0

G83 Peck Drill Cycle Comparison


G83 X2.00 Y3.00 Z-1.500 R.100 Q.250 F6.0 - OR N0110 G00 X2.00 Y3.00 N0120 G00 Z.100 N0130 G01 Z-.150 F6.0 N0140 G00 Z.1 N0150 G00 Z-.150 N0160 G01 Z-.400 N0170 G00 Z.1

WE ARE NOT DONE YET


N0180 G00 Z-.400 N0190 G01 Z-.650 N0200 G00 Z.100 N0210 G00 Z-.650 N0220 G01 Z-.900 N0230 G00 Z.100 N0240 G00 Z-.900 N0250 G01 Z-1.150 N0260 G00 Z.100

STILL A COUPLE MORE LINES


N0270 G00 Z-1.150 N0280 G01 Z-1.250 N0290 G00 Z.100

That is just for one hole! Now imagine doing that for EVERY deep hole! One line per hole versus 19 Lines you decide!

G73 Peck Drill Cycle (High Speed)


- Specifies that you want to drill to a given depth - Does NOT fully retract after each peck depth - Along with the G73 you will also need to specify the following:
Hole Position R-Plane Z Depth Feedrate Peck Increment

Example: G73 X2.00 Y3.00 Z-1.500 R.100 Q.250 F6.0

G84 Tapping Cycle (RH)


- Specifies that you want to Tap a previously drilled hole - Along with the G85 you will also need to specify the following:
Hole Position R-Plane Z Depth Feedrate = RPM X Lead of the thread
1/4-20 Thread at 800RPM = F40.0

Example: G84 X2.00 Y3.00 R.100 Z-.250 F40.0

G85 Boring Cycle


- Specifies that you want to Bore to a given depth - Along with the G85 you will also need to specify the following:
Hole Position R-Plane Z Depth Feedrate

Example: G85 X2.00 Y3.00 R.100 Z-.250 F6.0

CNC Vocab pit stop


- Cartesian Coordinate System (krt'zhn)
A system in which the location of a point is given by coordinates that represent its distances from perpendicular lines that intersect at a point called the origin.

G90 Absolute Programming


- The Origin or Datum location of your part does not move. - ALL coordinates are in relationship to one location in space

Example: G90 G00 X2.00 Y3.00 Z1.00

G91 Incremental Programming


- The Origin or Datum location of your part does moves as your tool moves - ALL coordinates are in relationship to the point the tool is located at

Example: G91 G00 X2.00 Y3.00 Z1.00

M Codes
- M Codes are known as Miscellaneous Functions. - Normally there should only be one M code per line. Most machines are really picky about this, more so than with G codes. - M Codes are to be at the start of the Block of Program. Example: M03 S1500

M00 Program Stop


- REMINDER: notice that it is M Zero Zero all of the G&M Codes use Zero and not the letter O. - M00 will stop the program without pressing Feed Hold - Insert M00 whenever you want to stop the program no matter what the conditions are. - Note: on some machines this will also turn off the spindle and not restart it without a M03 Example: M00

M01 Optional Stop


- M01 is a conditional stop, it is determined by an operator activated switch on the control panel - If the switch is on, it will stop the program identical to a M00 - If the switch is off, it will ignore the M01 - Best uses:
- Before or After Tool Changes - Anytime you want to inspect, oil or manipulate the part or tool

Example: M01

M02 End of Program


- M02 is used only at the end of the program - Some machines will not start a program unless it knows there is an end - M02 does not rewind the program

Example: M02 %

M03 Spindle Rotation Normal


- M03 Mill Clockwise rotation If you were on top of a vertical milling machine looking down - M03 Lathe Normal Rotation the direction the chuck would need to spin if you had a normal right hand helix drill bit

Example: M03 S1200

M04 Spindle Rotation Reverse


- M04 Mill Counter-Clockwise rotation If you were on top of a vertical milling machine looking down - M03 Lathe Reverse Rotation the opposite direction the chuck would need to spin if you had a normal right hand helix drill bit

Example: M04 S1200

M05 Spindle Off


- Turns spindle off

Example: M05

M06 Automatic Tool Changer


- AKA: ATC - Will put away the tool that is in the spindle and replace it with the tool that is identified on the same line as the M06

Example: M06 T01 or T01 M06

M07 Mist Coolant On


- Turns on Mist Coolant

Example: M07

M08 Flood Coolant On


- Turns on Flood Coolant

Example: M08

M08 Coolant Off


- Turns Off All Coolant pumps / Soleniods

Example: M09

M30 End of Program & Rewind


- M30 is used only at the end of the program - Some machines will not start a program unless it knows there is an end - M30 does rewind the program
- All you have to do is change the part and press cycle start

- More common than M02


- Especially if more than one part is to be made

Example: M30 %

M98 Sub-Program Call


- Used in a main program when you want to call up another program while still in the main program.

Example: M98 P1001

M99 Sub-Program End


- Used in place of an M30 when a program is used as a sub-program

Example: M99 %

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