Lecture of CNC Program
Lecture of CNC Program
Z Y
X The right hand rule is used to define the positive direction of the coordinate axes.
Nanfara, Fig. 2.1
X-Z Plane
Y-Z Plane
Nanfaro, Fig. 2-7
Absolute Coordinates
Incremental Coordinates
Letter Codes
Example CNC Program N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Each instruction to the machine consists of a letter followed by a number. Each letter is associated with a specific type of action or piece of information needed by the machine. Letters used in Codes N,G,X,Y,Z,A,B,C,I,J,K,F,S,T,R,M
Letter Codes
(G and M Codes) Example CNC Program N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 G-codes: Preparatory Functions involve actual tool moves. M-codes: Miscellaneous Functions involve actions necessary for machining (i.e. spindle on/off, coolant on/off).
Letter Codes
(G Codes)
G00 G01 G02 G03 G04 G08 G09 G17 G18 G19 G20 G21 Rapid traverse Linear interpolation Circular interpolation, CW Circular interpolation, CCW Dwell Acceleration Deceleration X-Y Plane Z-X Plane Y-Z Plane Inch Units (G70) Metric Units (G71)
G40 Cutter compensation cancel G41 Cutter compensation left G42 Cutter compensation- right G70 Inch format G71 Metric format G74 Full-circle programming off G75 Full-circle programming on G80 Fixed-cycle cancel G81-G89 Fixed cycles G90 Absolute dimensions G91 Incremental dimensions
Letter Codes
(M Codes) M00 M01 M02 M03 M04 M05 M06 M08 M09 M10 M11 M30 Program stop Optional program stop Program end Spindle on clockwise Spindle on counterclockwise Spindle stop Tool change Coolant on Coolant off Clamps on Clamps off Program stop, reset to start
Letter Codes
(N Codes) Example CNC Program N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 N-codes: Gives an identifying number for each block of information. It is generally good practice to increment each block number by 5 or 10 to allow additional blocks to be inserted if future changes are required.
Letter Codes
(X,Y, and Z Codes) Example CNC Program X, Y, and Z codes are used to N5 G90 G20 specify the coordinate axis. N10 M06 T3 Number following the code N15 M03 S1250 defines the coordinate at the end N20 G00 X1 Y1 of the move relative to an N25 Z0.1 incremental or absolute N30 G01 Z-0.125 F5 reference point. N35 X3 Y2 F10 N40 G00 Z1 The number may require that a N45 X0 Y0 specific format be used (i.e. 3.4 N50 M05 means three numbers before N55 M30 the decimal and four numbers after the decimal).
Letter Codes
(I,J, and K Codes) Example CNC Program N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 I, J, and K codes are used to specify the coordinate axis when defining the center of a circle. Number following the code defines the respective coordinate for the center of the circle. The number may require that a specific format be used (i.e. 3.4 means three numbers before the decimal and four numbers after the decimal).
Letter Codes
(F, S, and T Codes) Example CNC Program N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 F-code: used to specify the feed rate S-code: used to specify the spindle speed T-code: used to specify the tool identification number associated with the tool to be used in subsequent operations.
Letter Codes
(R and P Codes) Example CNC Program R-code: N5 G90 G20 Retract distance when used with N10 M06 T3 G81, 82, and 83. N15 M03 S1250 Radius when used with G02 and N20 G00 X1 Y1 G03. N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 P-code: Used to specify the dwell time associated with G04.
:1025 Program identification number. Follows the program start flag at the beginning of each program. Only two commands that dont start with a letter.
Nanfara, pg. 36
Nanfara, pg. 36
Nanfara, pg. 36
Block Format
Sample Block N135 G01 X1.0 Y1.0 Z0.125 F5 Restrictions on CNC blocks Each may contain only one tool move Each may contain any number of non-tool move G-codes Each may contain only one feedrate Each may contain only one specified tool or spindle speed The block numbers should be sequential Both the program start flag and the program number must be independent of all other commands (on separate lines) The data within a block should follow the sequence shown in the above sample block
Nanfara, pg. 36
Modal G-Codes
Example CNC Program N5 G90 G20 N10 M06 T3 N15 M03 S1250 N20 G00 X1 Y1 N25 Z0.1 N30 G01 Z-0.125 F5 N35 X3 Y2 F10 N40 G00 Z1 N45 X0 Y0 N50 M05 N55 M30 Most G-codes set the machine in a mode which stays in effect until it is changed or cancelled by another Gcode. These commands are called modal. In the example, G00 and G01 are modal.
Assignment
Review the material presented. Next class we look at an example, and will develop G-code programs in class.