Today there are a lot of CNC controls. Some of the best known are Fanuc, Siemens, Okuma and Heidenhain. In addition to the controls mentioned, there are many others. Common to all these controls is that they are built around codes consisting of a letter and some numbers. See below a G and M code list for a Fanuc and a Siemens controls and their functions. A number of these commands are ISO designations and will be found on other types of controls.
Fanuc G codes | Siemens G codes |
G00: Rapid Moves |
G00: Rapid Moves |
O1000 | Program Number |
N10 G40 G80 | Reset Radius Compensation, End Cycle, for safety |
N20 G28 G91 Z0 | Return to Safe Position for Tool Change |
N30 T02 M06 (50mm End Mill.) | Tool Change to Tool Number 2 |
N40 G90 G54 S1000 F500 M03 | Set Absolute Coordinates, Call Work Shift, Set Spindle Speed, Set Feed, Start Spindle Forward |
N50 G00 G43 H02 Z100 | Set Rapid, Call Length compensation from offset table for Tool 2, move to position Z100 above Z programming g zero. |
N60 G00 X-30 Y-30 Z5 | Rapid movement in X, Y and Z. |
N70 G01 Z-5 | Linear motion in Z. |
N80 G41 D22 X10 Y10 | Linear movement and apply Radius compensation (D value = 25 from offset table) |
N90 Y90 | Linear motion in Y. |
N100 X90 | Linear motion in X. |
N110 Y10 | Linear motion in Y. |
N120 X10 | Linear motion in X. |
N130 G00 X-30 Y-30 G40 | Rapid movement in X and Y, Cancel Radius Compensation |
N140 G28 G91 Z0 | Rapid Return to Safe Position |
N150 M30 | Program Stop and Reset |