mycnc:gcodes_list
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision | ||
mycnc:gcodes_list [2019/08/19 11:32] – ivan | mycnc:gcodes_list [2023/09/29 12:46] – ivan | ||
---|---|---|---|
Line 1: | Line 1: | ||
===== G-Codes list ===== | ===== G-Codes list ===== | ||
+ | |||
+ | Below is a list of G-codes currently implemented in the myCNC system. | ||
^ G-codes ^^^^ | ^ G-codes ^^^^ | ||
^ Code ^ Description ^ Mill (M)\\ Lathe(L)\\ Cutting table (C) ^ Comments ^ | ^ Code ^ Description ^ Mill (M)\\ Lathe(L)\\ Cutting table (C) ^ Comments ^ | ||
- | | G00 | Rapid Positioning | | + | | G00 | Rapid Positioning |
- | | G01 | Linear Interpolation | | + | | G01 | Linear Interpolation |
- | | G02 | Arc CCW Interpolation | | + | | G02 | Arc CCW Interpolation |
- | | G03 | Arc CW Interpolation | + | | G03 | Arc CW InterpolatioMotion Mode Canceln | | {{: |
- | | G04 | Dwell | | + | | G04 | Dwell | | In milliseconds. Will prevent the axes from moving during the specified time period |
- | | G5.1 | < | + | | G5.1 | < |
- | | G5.2 | < | + | | G5.2 | < |
- | | G5.3 | < | + | | G5.3 | < |
| G10 | [[mycnc: | | G10 | [[mycnc: | ||
| G11 | Mirror Cancel | | | G11 | Mirror Cancel | | ||
Line 21: | Line 23: | ||
| G18 | Plane ZX | | | G18 | Plane ZX | | ||
| G19 | Plane YZ | | | G19 | Plane YZ | | ||
- | | G20 | Unit Inches | | | + | | G20 | Set Units to Inches | | |
- | | G21 | Unit Metric | | | + | | G21 | Set Units to Metric | | |
- | | G28 | G28 Home | | + | | G28 | [[mycnc: |
| G28.1 | Home Position Set | | | G28.1 | Home Position Set | | ||
| G28.2 | Home Position #1 Save | | | G28.2 | Home Position #1 Save | | ||
Line 30: | Line 32: | ||
| G28.5 | Home Position #1 Restore | | | G28.5 | Home Position #1 Restore | | ||
| G28.6 | Home Position #2 Restore | | | G28.6 | Home Position #2 Restore | | ||
- | | G28.7 | Home Position #3 Restore | | ||
| G28.7 | Home Position #3 Restore | | | G28.7 | Home Position #3 Restore | | ||
| G28.9 | Home Position Address | | | G28.9 | Home Position Address | | ||
Line 37: | Line 38: | ||
| G33 | Spindle Synchronization | | | G33 | Spindle Synchronization | | ||
| G33 | Spindle Synchronization | | | G33 | Spindle Synchronization | | ||
- | | G38.2 | G38.2 Probing | | + | | G38.2 | G38.2 Probing |
| G38.3 | G38.3 Probing | | | G38.3 | G38.3 Probing | | ||
| G38.4 | G38.4 Probing | | | G38.4 | G38.4 Probing | | ||
| G38.5 | G38.5 Probing | | | G38.5 | G38.5 Probing | | ||
| G38.9 | Tool Measure | | | G38.9 | Tool Measure | | ||
- | | G40 | Tool Correction Cancel | | + | | G40 | Tool Correction Cancel |
- | | G41 | Tool Correction Left | | + | | G41 | Tool Correction Left | | {{: |
- | | G42 | Tool Correction Right | | + | | G42 | Tool Correction Right | | {{: |
| G43 | G43 Tool Length Offset | | | G43 | G43 Tool Length Offset | | ||
| G44 | G44 Tool Length Offset | | | G44 | G44 Tool Length Offset | | ||
Line 51: | Line 52: | ||
| G51 | G51 Scaling Set | M | | | G51 | G51 Scaling Set | M | | ||
| G50 | G50 Set Max Spindle Speed (Lathe) | L | | | G50 | G50 Set Max Spindle Speed (Lathe) | L | | ||
- | | G53 | Machine Coordinates | M L | | + | | G53 | Machine Coordinates | M L | The toolpath planner (as well as the the line/circle interpolation commands) work only in program coordinates. Therefore, the G53 code only works with G0 positioning commands. See note below on G53 & G0 usage. |
- | | G54 | Use Coordinate System #1 | M L | | + | | G54 | Use Coordinate System #1 | M L | Coordinate system switching codes G54-G59 change the offset between machine and work coordinates. As the toolpath planner does not have access to these commands, it is necessary to position the tool in the new coordinate system after switching (using G0) | |
| G55 | Use Coordinate System #2 | M L | | | G55 | Use Coordinate System #2 | M L | | ||
| G56 | Use Coordinate System #3 | M L | | | G56 | Use Coordinate System #3 | M L | | ||
Line 67: | Line 68: | ||
| G64 | < | | G64 | < | ||
| G65 | G-code macro | M | | | G65 | G-code macro | M | | ||
- | | G68 | Rotation Coordinates Mode On | M | | + | | G73 | [[mycnc: |
- | | G69 | Rotation Coordinates Mode Off | M | | + | |
- | | G73 | Cycle Deep Hole Drilling | M | | + | |
| G74 | Cycle Left Hand Tapping | M | | | G74 | Cycle Left Hand Tapping | M | | ||
- | | G76 | Cycle Lathe Thread | L | | + | | G76 | Cycle Lathe Thread | L | [[mycnc: |
- | | G76 | Motion Mode Cancel| L | | + | |
| G80 | Cancel Motion Mode | | | | G80 | Cancel Motion Mode | | | ||
- | | G81 | Cycle Drilling | | | + | | G81 | [[mycnc: |
| G82 | Cycle Drilling Dwell | | | | G82 | Cycle Drilling Dwell | | | ||
- | | G83 | Cycle Peck Drilling | | | + | | G83 | [[mycnc: |
| G84 | Cycle Right Hand Tapping | | | | G84 | Cycle Right Hand Tapping | | | ||
| G85 | Cycle Boring No Dwell Feed Out | | | G85 | Cycle Boring No Dwell Feed Out | | ||
Line 88: | Line 86: | ||
| G91.1 | Arc Center Incremental Programming | | | | | G91.1 | Arc Center Incremental Programming | | | | ||
| G92 | Set Work Position | M | | | G92 | Set Work Position | M | | ||
- | | G92 | Lathe Thread | L | | + | | G92 | [[mycnc: |
| G94 | Feedrate Per Minute | L | | | G94 | Feedrate Per Minute | L | | ||
| G95 | Feedrate Per Revolution | | | G95 | Feedrate Per Revolution | | ||
- | | G96 | Lathe Surface Speed | L | (constant | + | | G96 | [[mycnc: |
| G97 | Set Spindle Speed | L | (revolutions per minute) | | | G97 | Set Spindle Speed | L | (revolutions per minute) | | ||
- | | G98 | TURN_FEEDRATE_PER_MINUTE | L | | + | | G98 | Turn Feedrate per Minute |
- | | G99 | TURN_FEEDRATE_PER_REVOLUTION | + | | G98 | Canned Return Back to initial height |
- | | G98 | Canned Return Back | M | | | + | | G99 | Turn Feedrate per Revolution | L | |
- | | G99 | Canned Return | + | | G99 | Canned Return |
- | | G70 | Unit Inches | + | | G130 | Experimental feature - select a specific cutcharts mode from within a G-code program |
- | | G71 | Unit Metric | + | | G131 | Cut on/off. The P parameter loads in different cutting modes. |
| G150 | Tool Correction Radius Set | | | G150 | Tool Correction Radius Set | | ||
^ Miscellaneous M-codes ^^^^ | ^ Miscellaneous M-codes ^^^^ | ||
Line 122: | Line 120: | ||
| M23 | [[mycnc: | | M23 | [[mycnc: | ||
| M24 | [[mycnc: | | M24 | [[mycnc: | ||
- | | M30 | End Program with Rewind Pointer | Macro | | | + | | M30 | [[mycnc: |
| M41 | Set Low Gears | PLC | | | | M41 | Set Low Gears | PLC | | | ||
| M41 | Set High Gears | PLC | | | | M41 | Set High Gears | PLC | | | ||
Line 135: | Line 133: | ||
| M64 | Turn On binary output pin | PLC | | | | M64 | Turn On binary output pin | PLC | | | ||
| M65 | Turn Off binary output pin | PLC | | | | M65 | Turn Off binary output pin | PLC | | | ||
- | | M71 | Start Cutting | PLC | Cutting Tables | | + | | M71 | Start Cutting |
| M72 | Begin Plasma Marking Section | PLC | Cutting Tables | | | M72 | Begin Plasma Marking Section | PLC | Cutting Tables | | ||
| M73 | End Plasma Marking Section | PLC | Cutting Tables | | | M73 | End Plasma Marking Section | PLC | Cutting Tables | | ||
Line 148: | Line 146: | ||
| M101-199 | User defined M-codes (Section 2) | | | M101-199 | User defined M-codes (Section 2) | | ||
| M200-999 | User defined M-codes (Section 3) | | | M200-999 | User defined M-codes (Section 3) | | ||
+ | | M421 | Tool Length Measure | | ||
+ | | M422 | Tool Breakage Check | | ||
+ | | M440-M470 | Probing tool macros (locating surface, edges, etc) | | ||
^ Misc Macros ^^^^ | ^ Misc Macros ^^^^ | ||
^ Code ^ Description ^ Implementation ^ Comments ^ | ^ Code ^ Description ^ Implementation ^ Comments ^ | ||
^ Homing ^^^^ | ^ Homing ^^^^ | ||
- | | M131 | Homing X axis | Macro | | | ||
- | | M132 | Homing Y axis | Macro | | | ||
- | | M133 | Homing Z axis | Macro | | | ||
- | | M134 | Homing A axis | Macro | | | ||
- | | M135 | Homing B axis | Macro | | | ||
- | | M136 | Homing C axis | Macro | | | ||
- | | M138 | Homing All axes | Macro | | | ||
- | ^ Tool Measure ^^^^ | ||
| M131 | Homing X axis | Macro | | | | M131 | Homing X axis | Macro | | | ||
| M132 | Homing Y axis | Macro | | | | M132 | Homing Y axis | Macro | | | ||
Line 166: | Line 159: | ||
| M136 | Homing C axis | Macro | | | | M136 | Homing C axis | Macro | | | ||
| M138 | Homing All axes | Macro | | | | M138 | Homing All axes | Macro | | | ||
- | |||
Line 178: | Line 170: | ||
* Q - Parameter #2 | * Q - Parameter #2 | ||
* X, | * X, | ||
+ | |||
+ | - **L2** - set an offset between program and machine coordinates. P1 to P9 for coordinate systems G54 to G59.3 < | ||
- **L70** - set position to given values | - **L70** - set position to given values | ||
- **P0** - Set **Machine Position** to given values < | - **P0** - Set **Machine Position** to given values < | ||
- **P1** - Set Work Position in **G54** Coordinates system to given values < | - **P1** - Set Work Position in **G54** Coordinates system to given values < | ||
- **P2** - Set Work Position in **G55** Coordinates system to given values < | - **P2** - Set Work Position in **G55** Coordinates system to given values < | ||
- | - **P3** - Set Work Position in **G56** Coordinates system to given values < | + | - **P3** - Set Work Position in **G56** Coordinates system to given values < |
- **P4** - Set Work Position in **G57** Coordinates system to given values < | - **P4** - Set Work Position in **G57** Coordinates system to given values < | ||
- **P5** - Set Work Position in **G58** Coordinates system to given values < | - **P5** - Set Work Position in **G58** Coordinates system to given values < | ||
Line 195: | Line 188: | ||
- L180 - **Add** **Q** value to Register Address **P** and store the result to Register Address **P** <code C> | - L180 - **Add** **Q** value to Register Address **P** and store the result to Register Address **P** <code C> | ||
- L181 - **Subtract** **Q** value from Register Address **P** and store the result to Register Address **P** <code C> | - L181 - **Subtract** **Q** value from Register Address **P** and store the result to Register Address **P** <code C> | ||
- | - L182 - **Mul** Register Address **P** by **Q** value and store the iresult to Register Address **P** <code C>G10L180 | + | - L182 - **Mul** Register Address **P** by **Q** value and store the iresult to Register Address **P** <code C>G10L182 |
- | - L183 - **Divide** Register Address **P** to **Q**value and store the result to Register Address **P** <code C>G10L180 | + | - L183 - **Divide** Register Address **P** to **Q**value and store the result to Register Address **P** <code C>G10L183 |
- L184 - **Binary AND** value **Q** with Register Address **P** and store the result to Register Address **P** <code C> | - L184 - **Binary AND** value **Q** with Register Address **P** and store the result to Register Address **P** <code C> | ||
- L185 - **Binary OR** value **Q** with Register Address **P** and store the result to Register Address **P** <code C> | - L185 - **Binary OR** value **Q** with Register Address **P** and store the result to Register Address **P** <code C> | ||
Line 205: | Line 198: | ||
- L193 - **Divide** value from Register Address **P** to Register Address **Q** and store the result to Register Address **P** <code C> | - L193 - **Divide** value from Register Address **P** to Register Address **Q** and store the result to Register Address **P** <code C> | ||
- L194 - **ABS** calculate absolute value of Register Address **P** and store the result to Register Address **P** <code C> | - L194 - **ABS** calculate absolute value of Register Address **P** and store the result to Register Address **P** <code C> | ||
+ | - L200 - trigonometric functions support, a command with the format " | ||
+ | * | ||
+ | * L201 - reg1 = cos(reg2) | ||
+ | * L202 - reg1 = tan(reg2) | ||
+ | * L203 - reg1 = asin(reg2) | ||
+ | * L204 - reg1 = acos(reg2) | ||
+ | * L205 - reg1 = atan(reg2) | ||
+ | |||
+ | |||
+ | ==== G92/G96 for lathe cutting ==== | ||
+ | |||
+ | In a lathe system, G92 is used to set the maximum spindle speed (in the constant cutting speed mode), while G96 sets a constant surface cutting speed. In the code below, | ||
+ | |||
+ | < | ||
+ | N18 G0 X14 Z1 | ||
+ | N19 G92 S2500 | ||
+ | N20 G96 S220 M3</ | ||
+ | |||
+ | the G92 line will set the maximum speed to 2500 rpm, while the G96 line will switch the system to a 220 m/min constant cutting speed mode. | ||
+ | |||
+ | In this mode, the spindle speed is recalculated depending on the current diameter (the current X coordinate). | ||
+ | |||
+ | The rotation speed changes depending on the diameter, so that the cutting tool moves along the surface at a set speed of 220 meters/min. The larger the diameter, the slower the system will rotate the part, and if the diameter is smaller, then the rotation speed will increase. By this logic, the rotation speed can go to infinity when the diameter reaches 0, so G92 is used to set a maximum value. | ||
+ | |||
+ | In a lathe configuration, | ||
+ | |||
+ | For example, | ||
+ | |||
+ | < | ||
+ | and | ||
+ | < | ||
+ | |||
+ | should produce the same result (although some users may prefer G92 due to the general convention). However, a command such as | ||
+ | |||
+ | < | ||
+ | G92 Z-12 X20 F1 L2 P99</ | ||
+ | |||
+ | is automatically recognized by the system as a threading command instead. | ||
+ | |||
==== M07 - Plasma Dot Marking ==== | ==== M07 - Plasma Dot Marking ==== | ||
Line 234: | Line 266: | ||
g0moveA(0x0, | g0moveA(0x0, | ||
- | timer=100;do{ timer--; }while(timer> | + | timer=200;do{ timer--; }while(timer> |
do { code=gvarget(6060); | do { code=gvarget(6060); | ||
Line 247: | Line 279: | ||
g0moveA(0x0, | g0moveA(0x0, | ||
- | timer=100; | + | timer=200; |
do { code=gvarget(6060); | do { code=gvarget(6060); | ||
Line 282: | Line 314: | ||
{ | { | ||
g0moveA(0x0, | g0moveA(0x0, | ||
- | timer=100; | + | timer=200; |
do{ | do{ | ||
code=gvarget(6060); | code=gvarget(6060); | ||
Line 367: | Line 399: | ||
</ | </ | ||
+ | |||
+ | ==== G0G53 vs G1/G2/G3 commands ==== | ||
+ | |||
+ | //Keywords: Simulator Displacement Error, Critical Compiler Stop.// | ||
+ | |||
+ | When using G0G53 commands in machine coordinates, | ||
+ | |||
+ | Therefore, after such a switch, it is necessary to first give a positioning command using G0. This command must be given for those axes that were used as machine axes so that the controller can apply the appropriate offsets for the program coordinates. | ||
+ | |||
+ | For example, this issue will occur when a macro present within a G-code program will contain G0G53 commands (for instance, the M6 tool change macro), after which the G1/G2/G3 interpolation is used immediately. To go further with this example, the user CANNOT use the following combination: | ||
+ | |||
+ | <code C>M6T1 (in this example, M6 utilizes G0G53) | ||
+ | G1 Z5 | ||
+ | G1 Y5 X5</ | ||
+ | |||
+ | The code above will lead to a simulator displacement error. Instead, for the example above, the following code must be used: | ||
+ | |||
+ | <code C>M6T1 (in this example, M6 utilizes G0G53) | ||
+ | G0 Z5 | ||
+ | G0 Y5 X5</ | ||
+ | |||
+ | In this second code example, as the tool change macro uses G53 G0 XYZ, the first movement after a tool change will be G0 (for XYZ). This can either be done in G-code (via a post-processor which will correctly output G0 instead of G1 for that section), or within the tool change macro itself. | ||
mycnc/gcodes_list.txt · Last modified: 2023/09/29 14:15 by ivan