CNC Codes and Letters
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. [email protected]
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
- 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
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
That is just for one hole! Now imagine doing that for EVERY deep hole! One line per hole versus 19 Lines you decide!
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
Example: M01
Example: M02 %
Example: M05
Example: M07
Example: M08
Example: M09
Example: M30 %
Example: M99 %