Cnc Codes and Letters

Embed Size (px)

Citation preview

  • 7/28/2019 Cnc Codes and Letters

    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. Someexamples 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. [email protected]

  • 7/28/2019 Cnc Codes and Letters

    2/48

    You should already have alist of G&M Codes and

    CNC Letters as shown. If

    you do not have one, see

    your instructor, ordownload one off of the

    South Adams / Area 18

    Machine Trades

    Code Meaning Letter Meaning

    G00 Positioning (Rapid Traverse) A Rotary indexing axis around the "X" axis

    G01 Linear Interpolation (Feed) B Rotary indexing axis around the "Y" axis

    G02 Circular Interpolation CW C Rotary indexing axis around the "Z" axis

    G03 Circular Interpolation CCW D Cutter Radius / Diameter offset number

    G04 Dwell E Feedrate in inches per revolution (Lathe)

    G17 X,Y Plane of Interpolation F Feedrate in inches per minute (can be used on lathes)

    G18 X,Z Plane of Interpolation G Preparatory commands

    G19 Y,Z Plane of Interpolation H Offset Number (Mill - tool length)(Lathe - Position offset)

    G20 Input in Inch I Arc center location in the "X" axis

    G21 Input in MM J Arc center location in the "Y" axis

    G28 Return to Machine zero (reference point) K Arc center location in the "Z" axis

    G40 Cutter Compensation cancel L Fixed Cycle repetion count / subprogram repetition count

    G41 Cutter Compensation left M Miscellaneous function

    G42 Cutter Compensation right N Block / Sequence number

    G43 Tool length compensation + O Program Number

    G44 Tool length compensation - P Subprogram / Macro Number call

    G54-G59 Set Local Coordinate Systems (Datum Shifts) P Dwell time in milliseconds

    G80 Canned Cycle cancel P Block number in main program when used with M99

    G81 Spot Drilling Cycle (no dwell) Q Depth of peck in fixed cycles (G73and G83)

    G82 Drill/Counterbore (with dwell) Q Shift amount in fixed cycle (G76 and G87)

    G83 Peck Drilling Cycle R Retract point in fixed cycles

    G85 Bore R Arc Radius designation

    G90 Absolute Programming S Spindle speed in RPMs

    G91 Incremental Programming T Tool function

    G92 Set Program Zero U Incremental move in "X" axis

    G94 IPM Programming V Incremental move in "Y" axis

    G95 IPR Programming W Incremental move in "Z" axis

    M00 Program stop X "X" axis coordinate value designation

    M01 Optional stop Y "Y" axis coordinate value designation

    M02 End of Program Z "Z" axis coordinate value designation

    M03 Start Spindle (Clockwise)

    M04 Start Spindle (Counterclockwise)

    M05 Spindle off

    M06 Tool change

    M08 Coolant on

    M09 Coolant off

    M30 Program reset/tape rewind

    M98 Sub-Program call

    M99 Return to previous program

  • 7/28/2019 Cnc Codes and Letters

    3/48

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

    Safety Line Example: G17 G20 G40 G80 G90

  • 7/28/2019 Cnc Codes and Letters

    4/48

    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 fromwhere 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 willgo from point A to point B in a straight line as fastas possible

    Example: G00 X2.00 Y3.00

  • 7/28/2019 Cnc Codes and Letters

    5/48

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

    - 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

  • 7/28/2019 Cnc Codes and Letters

    6/48

    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

  • 7/28/2019 Cnc Codes and Letters

    7/48

    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!

  • 7/28/2019 Cnc Codes and Letters

    8/48

    CNC Vocab pit stop

    - Modal [mohd-l]

    - A Command that is to remain in acertain mode until canceled byanother mode

    - In other words: it keeps going andgoing and going and going.. Untilit is told to stop later in the program

    - Antonym = Non-modal

  • 7/28/2019 Cnc Codes and Letters

    9/48

    G04 Dwell-G04 is used anytime you want to pause or dwell

    at a position- A common Block when Dwell is required

    would beG04 P500

    -The G04 of course specifies Dwell-The P500 states that it will be for 500 milliseconds

    - 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

  • 7/28/2019 Cnc Codes and Letters

    10/48

    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

  • 7/28/2019 Cnc Codes and Letters

    11/48

    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 wouldbe like looking at the screen of the controller since

    the X axis is right and left and the Z axis is up

    and down.

  • 7/28/2019 Cnc Codes and Letters

    12/48

    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.

  • 7/28/2019 Cnc Codes and Letters

    13/48

    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 eachprogram 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, everydimension you enter will be read by the CNC as

    metric. OPPS!

  • 7/28/2019 Cnc Codes and Letters

    14/48

    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.

  • 7/28/2019 Cnc Codes and Letters

    15/48

    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 asclose 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

  • 7/28/2019 Cnc Codes and Letters

    16/48

    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 differentthan what you need, cutter compensation cancel will

    clear everything out and be ready for you to add.

  • 7/28/2019 Cnc Codes and Letters

    17/48

    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 thispicture 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!

  • 7/28/2019 Cnc Codes and Letters

    18/48

    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!

  • 7/28/2019 Cnc Codes and Letters

    19/48

    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

  • 7/28/2019 Cnc Codes and Letters

    20/48

    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

  • 7/28/2019 Cnc Codes and Letters

    21/48

    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

  • 7/28/2019 Cnc Codes and Letters

    22/48

    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

  • 7/28/2019 Cnc Codes and Letters

    23/48

    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

  • 7/28/2019 Cnc Codes and Letters

    24/48

    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

  • 7/28/2019 Cnc Codes and Letters

    25/48

    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

  • 7/28/2019 Cnc Codes and Letters

    26/48

    G83 Peck Drill Cycle ComparisonG83 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-.150N0160 G01 Z-.400

    N0170 G00 Z.1

  • 7/28/2019 Cnc Codes and Letters

    27/48

    WE ARE NOT DONE YETN0180 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-.900N0250 G01 Z-1.150

    N0260 G00 Z.100

  • 7/28/2019 Cnc Codes and Letters

    28/48

    STILL A COUPLE MORE LINESN0270 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!

  • 7/28/2019 Cnc Codes and Letters

    29/48

    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

  • 7/28/2019 Cnc Codes and Letters

    30/48

    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

  • 7/28/2019 Cnc Codes and Letters

    31/48

    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

  • 7/28/2019 Cnc Codes and Letters

    32/48

    CNC Vocab pit stop- Cartesian Coordinate System(krt'zhn)

    A system in which the location of a point is givenby coordinates that represent its distances fromperpendicular lines that intersect at a point calledthe origin.

  • 7/28/2019 Cnc Codes and Letters

    33/48

    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

  • 7/28/2019 Cnc Codes and Letters

    34/48

    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

  • 7/28/2019 Cnc Codes and Letters

    35/48

    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

  • 7/28/2019 Cnc Codes and Letters

    36/48

    M00 Program Stop- REMINDER: notice that it is M Zero Zero

    all of the G&M Codes use Zero and not theletter 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 offthe spindle and not restart it without a M03

    Example: M00

  • 7/28/2019 Cnc Codes and Letters

    37/48

    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

  • 7/28/2019 Cnc Codes and Letters

    38/48

    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%

  • 7/28/2019 Cnc Codes and Letters

    39/48

    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

  • 7/28/2019 Cnc Codes and Letters

    40/48

    M04 Spindle Rotation Reverse- M04 Mill Counter-Clockwise rotation If you

    were on top of a vertical milling machinelooking down

    - M03 Lathe Reverse Rotation the opposite

    direction the chuck would need to spin if youhad a normal right hand helix drill bit

    Example: M04 S1200

    dl ff

  • 7/28/2019 Cnc Codes and Letters

    41/48

    M05 Spindle Off- Turns spindle off

    Example: M05

    i l h

  • 7/28/2019 Cnc Codes and Letters

    42/48

    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

    0 i C l O

  • 7/28/2019 Cnc Codes and Letters

    43/48

    M07 Mist Coolant On- Turns on Mist Coolant

    Example: M07

    M08 Fl d C l O

  • 7/28/2019 Cnc Codes and Letters

    44/48

    M08 Flood Coolant On- Turns on Flood Coolant

    Example: M08

    M08 C l Off

  • 7/28/2019 Cnc Codes and Letters

    45/48

    M08 Coolant Off- Turns Off All Coolant pumps / Soleniods

    Example: M09

    M30 E d f P & R i d

  • 7/28/2019 Cnc Codes and Letters

    46/48

    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 S b P C ll

  • 7/28/2019 Cnc Codes and Letters

    47/48

    M98 Sub-Program Call- Used in a main program when you want to call

    up another program while still in the mainprogram.

    Example: M98 P1001

    M99 S b P E d

  • 7/28/2019 Cnc Codes and Letters

    48/48

    M99 Sub-Program End- Used in place of an M30 when a program is

    used as a sub-program

    Example: M99

    %