Difference between revisions of "G-Code"

From CNC.xyz Wiki
Jump to: navigation, search
(M-Commands)
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
 +
G-Code (also known as the RS-274 standard) is the numerical control language that is used to program most CNC Machines. There are several variations to the code used and not all G-code is created equally. Please check with the CNC control software ([[Mach3]], [[LinuxCNC]], [[UCCNC_Software|UCCNC]], [[Grbl]]) for specific reference and setup with CNC processors.
 +
 
{| class="wikitable"
 
{| class="wikitable"
 
|-
 
|-
! Header text !! Header text
+
! G-Code !! Code Description
 
|-
 
|-
| [[G0]] || Coordinated Straight Motion Rapid Rate
+
| [[G00]] || Rapid Positioning
 
|-
 
|-
| [[G1]] || Coordinated Straight Motion Feed Rate
+
| [[G01]] || Linear Interpolation
 
|-
 
|-
| [[G2]] [[G3]] || Coordinated Helical Motion Feed Rate
+
| [[G02]] || Circular Interpolation, Clockwise
 
|-
 
|-
| [[G4]] || Dwell
+
| [[G03]] || Circular Interpolation, Counterclockwise
 
|-
 
|-
| [[G5.1]] || Quadratic B-Spline
+
| [[G04]] || Dwell
 
|-
 
|-
| [[G5.2]] [[G5.3]] || NURBs Block
+
| [[G10]] || Coordinate System Origin Setting
 
|-
 
|-
| [[G7]] || Diameter Mode (lathe)
+
| [[G17]] || XY Plane Selection
 
|-
 
|-
| [[G8]] || Radius Mode (lathe)
+
| [[G18]] || XZ Plane Selection
 
|-
 
|-
| [[G10 L1]] || Set Tool Table Entry
+
| [[G19]] || YZ Plane Selection
 
|-
 
|-
| [[G10 L10]] || Set Tool Table, Calculated, Workpiece
+
| [[G20]] || Unit Selection: Inch
 
|-
 
|-
| [[G10 L11]] || Set Tool Table, Calculated, Fixture
+
| [[G21]] || Unit Selection: MM
 
|-
 
|-
| [[G10 L2]] || Coordinate System Origin Setting
+
| [[G27]] || Verify Home
 
|-
 
|-
| [[G10 L20]] || Coordinate System Origin Setting Calculated
+
| [[G28]] || Home Return (Soft Home)
 
|-
 
|-
| [[G17]] - [[G19.1]] || Plane Select
+
| [[G30]] || Home
 
|-
 
|-
| [[G20 G21]] || Units of Measure
+
| [[G33]] || Lathe Thread Cycle
 
|-
 
|-
| [[G28]] - [[G28.1]] || Go to Predefined Position
+
| [[G40]] || Cancel Cutter Compensation
 
|-
 
|-
| [[G30]] - [[G30.1]] || Go to Predefined Position
+
| [[G41]] || Cutter Compensation Left
 
|-
 
|-
| [[G33]] || Spindle Synchronized Motion
+
| [[G42]] || Cutter Compensation Right
 
|-
 
|-
| [[G33.1]] || Rigid Tapping
+
| [[G43]] || Tool Length Offset
 
|-
 
|-
| [[G38.2]] - [[G38.5]] || Probing
+
| [[G49]] || Cancel Tool Length Offset
 
|-
 
|-
| [[G40]] || Cancel Cutter Compensation
+
| [[G53]] || Motion in Machine Coordinate System
 
|-
 
|-
| [[G41]] [[G42]] || Cutter Compensation
+
| [[G54]] || Select Coordinate System 1
 
|-
 
|-
| [[G41.1]] [[G42.1]] || Dynamic Cutter Compensation
+
| [[G55]] || Select Coordinate System 2
 
|-
 
|-
| [[G43]] || Use Tool Length Offset from Tool Table
+
| [[G56]] || Select Coordinate System 3
 
|-
 
|-
| [[G43.1]] || Dynamic Tool Length Offset
+
| [[G57]] || Select Coordinate System 4
 
|-
 
|-
| [[G49]] || Cancel Tool Length Offset
+
| [[G58]] || Select Coordinate System 5
 
|-
 
|-
| [[G53]] || Motion in Machine Coordinate System
+
| [[G59]] || Select Coordinate System 6
 
|-
 
|-
| [[G54]] - [[G59]] || Select Coordinate System (1 - 6)
+
| [[G59.1]] || Select Coordinate System 7
 
|-
 
|-
| [[G59.1]] - [[G59.3]] || Select Coordinate System (7 - 9)
+
| [[G59.2]] || Select Coordinate System 8
 
|-
 
|-
| [[G61]] [[G61.1]] || Path Control Mode
+
| [[G59.3]] || Select Coordinate System 9
 
|-
 
|-
| [[G64]] || Path Control Mode with Optional Tolerance
+
| [[G65]] || Subroutine
|-
 
| [[G73]] || Drilling Cycle with Chip Breaking
 
|-
 
| [[G76]] || Multi-pass Threading Cycle (Lathe)
 
 
|-
 
|-
 
| [[G80]] || Cancel Motion Modes
 
| [[G80]] || Cancel Motion Modes
Line 80: Line 78:
 
|-
 
|-
 
| [[G86]] || Boring Cycle, Stop, Rapid Out
 
| [[G86]] || Boring Cycle, Stop, Rapid Out
 +
|-
 +
| [[G87]] || Back Boring Cycle
 +
|-
 +
| [[G88]] || Boring Cycle, Stop, Manual Out
 
|-
 
|-
 
| [[G89]] || Boring Cycle, Dwell, Feed Out
 
| [[G89]] || Boring Cycle, Dwell, Feed Out
 
|-
 
|-
| [[G90]] [[G91]] || Distance Mode
+
| [[G90]] || Absolute Distance Mode
 
|-
 
|-
| [[G90.1]] [[G91.1]] || Arc Distance Mode
+
| [[G91]] || Incremental Distance Mode
 
|-
 
|-
 
| [[G92]] || Coordinate System Offset
 
| [[G92]] || Coordinate System Offset
 
|-
 
|-
| [[G92.1]] [[G92.2]] || Cancel Coordinate System Offsets
+
| [[G92.2]] || Cancel Coordinate System Offsets
 
|-
 
|-
 
| [[G92.3]] || Restore Axis Offsets
 
| [[G92.3]] || Restore Axis Offsets
 
|-
 
|-
| [[G93]] [[G94]] [[G95]] || Feed Modes
+
| [[G93]] || Inverse Time Feed Mode
 +
|-
 +
| [[G94]] || Feed per Minute Mode
 +
|-
 +
| [[G95]] || Feed per Revolution Mode
 
|-
 
|-
 
| [[G96]] || Constant Surface Speed
 
| [[G96]] || Constant Surface Speed
Line 99: Line 105:
 
| [[G97]] || RPM Mode
 
| [[G97]] || RPM Mode
 
|-
 
|-
| [[G98]] [[G99]] || Canned Cycle Z Retract Mode
+
| [[G98]] || Initial Level Return in Canned Cycles
 +
|-
 +
| [[G99]] || R-Point Level Return in Canned Cycles
 +
|}
 +
 
 +
==M-Commands==
 +
 
 +
The following is a list of the most typical M-Commands that are supported by every major CNC motion controller program. Beyond M09, most software will allow the creation of custom M-Commands. Consult the documentation for your specific commands associated with your software and machine. Not all commands will be available.
 +
 
 +
{| class="wikitable"
 +
|-
 +
! M-Command !! Code Description
 +
|-
 +
| [[M00]] || Program Stop
 +
|-
 +
| [[M01]] || Optional Stop
 +
|-
 +
| [[M02]] || Program End
 +
|-
 +
| [[M03]] || Spindle On, Clockwise
 +
|-
 +
| [[M04]] || Spindle On, Counter-Clockwise
 +
|-
 +
| [[M05]] || Spindle Off
 +
|-
 +
| [[M06]] || Tool change
 +
|-
 +
| [[M07]] || Mist Coolant On
 +
|-
 +
| [[M08]] || Flood Coolant On
 +
|-
 +
| [[M09]] || Coolant Off
 
|}
 
|}

Latest revision as of 06:25, November 25, 2015

G-Code (also known as the RS-274 standard) is the numerical control language that is used to program most CNC Machines. There are several variations to the code used and not all G-code is created equally. Please check with the CNC control software (Mach3, LinuxCNC, UCCNC, Grbl) for specific reference and setup with CNC processors.

G-Code Code Description
G00 Rapid Positioning
G01 Linear Interpolation
G02 Circular Interpolation, Clockwise
G03 Circular Interpolation, Counterclockwise
G04 Dwell
G10 Coordinate System Origin Setting
G17 XY Plane Selection
G18 XZ Plane Selection
G19 YZ Plane Selection
G20 Unit Selection: Inch
G21 Unit Selection: MM
G27 Verify Home
G28 Home Return (Soft Home)
G30 Home
G33 Lathe Thread Cycle
G40 Cancel Cutter Compensation
G41 Cutter Compensation Left
G42 Cutter Compensation Right
G43 Tool Length Offset
G49 Cancel Tool Length Offset
G53 Motion in Machine Coordinate System
G54 Select Coordinate System 1
G55 Select Coordinate System 2
G56 Select Coordinate System 3
G57 Select Coordinate System 4
G58 Select Coordinate System 5
G59 Select Coordinate System 6
G59.1 Select Coordinate System 7
G59.2 Select Coordinate System 8
G59.3 Select Coordinate System 9
G65 Subroutine
G80 Cancel Motion Modes
G81 Drilling Cycle
G82 Drilling Cycle with Dwell
G83 Drilling Cycle with Peck
G85 Boring Cycle, No Dwell, Feed Out
G86 Boring Cycle, Stop, Rapid Out
G87 Back Boring Cycle
G88 Boring Cycle, Stop, Manual Out
G89 Boring Cycle, Dwell, Feed Out
G90 Absolute Distance Mode
G91 Incremental Distance Mode
G92 Coordinate System Offset
G92.2 Cancel Coordinate System Offsets
G92.3 Restore Axis Offsets
G93 Inverse Time Feed Mode
G94 Feed per Minute Mode
G95 Feed per Revolution Mode
G96 Constant Surface Speed
G97 RPM Mode
G98 Initial Level Return in Canned Cycles
G99 R-Point Level Return in Canned Cycles

M-Commands

The following is a list of the most typical M-Commands that are supported by every major CNC motion controller program. Beyond M09, most software will allow the creation of custom M-Commands. Consult the documentation for your specific commands associated with your software and machine. Not all commands will be available.

M-Command Code Description
M00 Program Stop
M01 Optional Stop
M02 Program End
M03 Spindle On, Clockwise
M04 Spindle On, Counter-Clockwise
M05 Spindle Off
M06 Tool change
M07 Mist Coolant On
M08 Flood Coolant On
M09 Coolant Off