Introduction to G Codes and M Codes
Fanuc M-Code G-Code, G codes (preparatory commands) and M codes (auxiliary commands) are essential instructions used to control machine tools.
- G codes govern motion, positioning, and machining operations (e.g., linear interpolation, circular movements, tool compensation).
- M codes manage auxiliary functions (e.g., spindle control, coolant activation, tool changes).
These Fanuc M-Code G-Code vary slightly depending on the machine type (lathe, mill, etc.) and Fanuc control version. Always consult your machine’s manual for specifics.
Common Fanuc G Codes
Code | Description |
---|---|
G00 | Rapid positioning (fast traverse) |
G01 | Linear interpolation (straight-line motion) |
G02 | Circular interpolation (clockwise) |
G03 | Circular interpolation (counterclockwise) |
G04 | Dwell (pause) |
G05 | non standard g-code |
G17 | XY plane selection |
G18 | XZ plane selection |
G19 | YZ plane selection |
G20 | Programming in inches |
G21 | Programming in millimeters |
G28 | Return to reference position (home) |
G30 | Return to secondary reference position |
G40 | Cancel tool radius compensation |
G41 | Tool radius compensation left |
G42 | Tool radius compensation right |
G43 | Tool length compensation (positive) |
G44 | Tool length compensation (negative) |
G49 | Cancel tool length compensation |
G54–G59 | Work coordinate system (WCS) selection |
G61 | Exact stop check (precision mode) |
G90 | Absolute programming |
G91 | Incremental programming |
G92 | Set position by programming |
G94 | Per-minute feedrate mode |
G95 | Per-revolution feedrate mode |
G100–G199 | Macro programs (varies by configuration) |
Common Fanuc M Codes
Code | Description |
---|---|
M00 | Program stop |
M01 | Optional stop |
M02 | Program end |
M03 | Spindle on (clockwise) |
M04 | Spindle on (counterclockwise) |
M05 | Spindle stop |
M06 | Tool change |
M07 | Mist coolant on |
M08 | Flood coolant on |
M09 | Coolant off |
M10 | Chuck close |
M11 | Chuck open |
M19 | Spindle orientation |
M20 | Open tool magazine door |
M21 | Close tool magazine door |
M28 | Enable external data input |
M29 | Disable external data input |
M30 | Program end and return to start |
M41–M49 | Tool changer preparation |
M61–M69 | Tool selection (machine-specific) |
M98 | Subprogram call |
M99 | Subprogram return |
M100–M199 | Customizable codes (user-defined) |
Notes
- Variations: Codes may differ by machine manufacturer or Fanuc control version.
- Documentation: Always refer to your machine’s manual for exact code definitions.
- Compatibility: Codes depend on the machine type (e.g., lathe vs. mill).
For exhaustive lists of Fanuc M-Code G-Code, consult Fanuc technical manuals or your machine’s programming guide.
Discover more from digit chain
Subscribe to get the latest posts sent to your email.