User Tools

Site Tools


mycnc:gcodes_list

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
mycnc:gcodes_list [2019/09/27 09:21] ivanmycnc:gcodes_list [2023/09/29 14:15] (current) ivan
Line 5: Line 5:
 ^ 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 | | {{:mycnc:gcodes-list-003-g0.jpg}} | +| G00 | Rapid Positioning | | {{:mycnc:gcodes-list-003-g0.jpg}}. See [[mycnc:gcodes_list#g0g53_vs_g1g2g3_commands|note]] on G53. 
 | G01 | Linear Interpolation | | {{:mycnc:gcodes-list-004-g1.jpg}} | | G01 | Linear Interpolation | | {{:mycnc:gcodes-list-004-g1.jpg}} |
 | G02 | Arc CCW Interpolation | | {{:mycnc:gcodes-list-005-g02.jpg}} | | G02 | Arc CCW Interpolation | | {{:mycnc:gcodes-list-005-g02.jpg}} |
-| G03 | Arc CW Interpolation | | {{:mycnc:gcodes-list-006-g3.jpg}} | +| G03 | Arc CW InterpolatioMotion Mode Canceln | | {{:mycnc:gcodes-list-006-g3.jpg}} | 
 | G04 | Dwell | | In milliseconds. Will prevent the axes from moving during the specified time period | | G04 | Dwell | | In milliseconds. Will prevent the axes from moving during the specified time period |
 | G5.1 | <del>Spline Interpolation</del> | | G5.1 | <del>Spline Interpolation</del> |
Line 32: 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 45: Line 44:
 | G38.9 | Tool Measure | | G38.9 | Tool Measure |
 | G40 | Tool Correction Cancel | | {{:mycnc:gcodes-list-008-g40.jpg}} | | G40 | Tool Correction Cancel | | {{:mycnc:gcodes-list-008-g40.jpg}} |
-| G41 | Tool Correction Left | | {{:mycnc:gcodes-list-009-g41.jpg}} |+| G41 | Tool Correction Left | | {{:mycnc:gcodes-list-009-g41.jpg}} \\ [[https://www.youtube.com/watch?v=tRR2q0ao0Dc|YouTube link]]|
 | G42 | Tool Correction Right | | {{:mycnc:gcodes-list-010-g42.jpg}} | | G42 | Tool Correction Right | | {{:mycnc:gcodes-list-010-g42.jpg}} |
 | G43 | G43 Tool Length Offset | | G43 | G43 Tool Length Offset |
Line 53: 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 69: Line 68:
 | G64 | <del>Mode Cutting</del> | M | | G64 | <del>Mode Cutting</del> | M |
 | G65 | G-code macro | M | | G65 | G-code macro | M |
-| G73 | Cycle Deep Hole Drilling | M |+| G73 | [[mycnc:drilling_cycle|Cycle Deep Hole Drilling]] | M | {{:mycnc:drilling-cycle-005-g98g73.png?200}} |
 | G74 | Cycle Left Hand Tapping | M | | G74 | Cycle Left Hand Tapping | M |
-| G76 | Cycle Lathe Thread | L | +| G76 | Cycle Lathe Thread | L | [[mycnc:gcodes_list:g76-thread-cycle|G76 Thread Cycle]] 
-| G76 | Motion Mode Cancel| L |+
 | G80 | Cancel Motion Mode | | | G80 | Cancel Motion Mode | |
-| G81 | Cycle Drilling | |+| G81 | [[mycnc:drilling_cycle|Cycle Drilling]] | {{:mycnc:drilling-cycle-003-g98g81.png?200}} |
 | G82 | Cycle Drilling Dwell | | | G82 | Cycle Drilling Dwell | |
-| G83 | Cycle Peck Drilling | |+| G83 | [[mycnc:drilling_cycle|Cycle Peck Drilling]] | {{:mycnc:drilling-cycle-001-g98.jpg?200}} |
 | 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:gcodes_list#G92/G96 for lathe cutting|Lathe Thread]] | L | For example, <code>G92 S3300</code> will set a max spindle speed of 3300 in the constant cutting speed mode |
 | G94 | Feedrate Per Minute | L | | G94 | Feedrate Per Minute | L |
 | G95 | Feedrate Per Revolution | | G95 | Feedrate Per Revolution |
-| G96 | Lathe Surface Speed | L | (constant surface for lathe|+| G96 | [[mycnc:gcodes_list#G92/G96 for lathe cutting|Lathe Surface Speed]] | L | Constant surface speed for lathe with a given speed. For example, \\ <code>G96 S220 M3</code> will set system to constant cutting speed mode at 220 units/min |
 | 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 | L |
Line 97: Line 95:
 | G99 | Turn Feedrate per Revolution | L | | G99 | Turn Feedrate per Revolution | L |
 | G99 | Canned Return to a set height | M | As opposed to G98, which returns the tool to the initial height (height before cutting), G99 returns the tool to some set height Z. {{:mycnc:gcodes-list-007-g98g99.jpg}} | | G99 | Canned Return to a set height | M | As opposed to G98, which returns the tool to the initial height (height before cutting), G99 returns the tool to some set height Z. {{:mycnc:gcodes-list-007-g98g99.jpg}} |
 +| G130 | Experimental feature - select a specific cutcharts mode from within a G-code program (for example, G130 P217 will select mode #217) |
 +| G131 | Cut on/off. The P parameter loads in different cutting modes. | | G131 P0 - disable, G131 P1....16 - enable the corresponding mode. Power control (DAC-PWM) is activated accordingly per mode. |
 | G150 | Tool Correction Radius Set | | G150 | Tool Correction Radius Set |
 ^ Miscellaneous M-codes ^^^^ ^ Miscellaneous M-codes ^^^^
Line 133: 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 [[https://www.youtube.com/watch?v=t5QBOag0g6Y|YouTube video]]| PLC | Cutting Tables |
 | 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 170: Line 170:
   * Q - Parameter #2   * Q - Parameter #2
   * X,Y,Z,A,B,C,U,V,W - coordinates/values   * X,Y,Z,A,B,C,U,V,W - coordinates/values
 +   
 +  - **L2** - set an offset between program and machine coordinates. P1 to P9 for coordinate systems G54 to G59.3 <code>G10 L2 P1 X1 Y1 Z1 (Set G54 offset X to 1, Y to 1, Z to 1)</code>
   - **L70** - set position to given values   - **L70** - set position to given values
     - **P0** - Set **Machine Position** to given values <code>G10L70 P0 X0 Y0 (Set Machine coordinates X=0, Y=0)</code>     - **P0** - Set **Machine Position** to given values <code>G10L70 P0 X0 Y0 (Set Machine coordinates X=0, Y=0)</code>
     - **P1** - Set Work Position in **G54** Coordinates system to given values <code>G10L70 P1 X10 Y20 Z30 (Set G54/Work coordinates X=10, Y=20, Z=30)</code><code>G10L70 P1 X0 Y0 Z0 A0 B0 C0 (Set G54/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>     - **P1** - Set Work Position in **G54** Coordinates system to given values <code>G10L70 P1 X10 Y20 Z30 (Set G54/Work coordinates X=10, Y=20, Z=30)</code><code>G10L70 P1 X0 Y0 Z0 A0 B0 C0 (Set G54/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>
     - **P2** - Set Work Position in **G55** Coordinates system to given values <code>G10L70 P2 X0 Y10 Z20 (Set G55/Work coordinates X=0, Y=10, Z=20)</code><code>G10L70 P2 X0 Y0 Z0 A0 B0 C0 (Set G55/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>     - **P2** - Set Work Position in **G55** Coordinates system to given values <code>G10L70 P2 X0 Y10 Z20 (Set G55/Work coordinates X=0, Y=10, Z=20)</code><code>G10L70 P2 X0 Y0 Z0 A0 B0 C0 (Set G55/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>
-    - **P3** - Set Work Position in **G56** Coordinates system to given values <code>G10L70 P2 X0 Y10 Z20 (Set G56/Work coordinates X=0, Y=10, Z=20)</code><code>G10L70 P2 X0 Y0 Z0 A0 B0 C0 (Set G56/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>+    - **P3** - Set Work Position in **G56** Coordinates system to given values <code>G10L70 P2 X0 Y10 Z20 (Set G56/Work coordinates X=0, Y=10, Z=20)</code><code>G10L70 P3 X0 Y0 Z0 A0 B0 C0 (Set G56/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>
     - **P4** - Set Work Position in **G57** Coordinates system to given values <code>G10L70 P4 X0 Y10 Z20 (Set G57/Work coordinates X=0, Y=10, Z=20)</code><code>G10L70 P4 X0 Y0 Z0 A0 B0 C0 (Set G57/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>     - **P4** - Set Work Position in **G57** Coordinates system to given values <code>G10L70 P4 X0 Y10 Z20 (Set G57/Work coordinates X=0, Y=10, Z=20)</code><code>G10L70 P4 X0 Y0 Z0 A0 B0 C0 (Set G57/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>
     - **P5** - Set Work Position in **G58** Coordinates system to given values <code>G10L70 P5 X0 Y10 Z20 (Set G58/Work coordinates X=0, Y=10, Z=20)</code><code>G10L70 P5 X0 Y0 Z0 A0 B0 C0 (Set G58/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>     - **P5** - Set Work Position in **G58** Coordinates system to given values <code>G10L70 P5 X0 Y10 Z20 (Set G58/Work coordinates X=0, Y=10, Z=20)</code><code>G10L70 P5 X0 Y0 Z0 A0 B0 C0 (Set G58/Work coordinates X=0,Y=0,Z=0,A=0,B=0,C=0)</code>
Line 187: Line 188:
   - L180 - **Add** **Q** value to Register Address **P** and store the result to Register Address **P** <code C>G10L180 P100 Q10 (//Add 10 to Register #100 // #100=#100 + 10 //)</code>   - L180 - **Add** **Q** value to Register Address **P** and store the result to Register Address **P** <code C>G10L180 P100 Q10 (//Add 10 to Register #100 // #100=#100 + 10 //)</code>
   - L181 - **Subtract** **Q** value from Register Address **P** and store the result to Register Address **P** <code C>G10L181 P100 Q10 (//Subtract 10 from Register #100 // #100=#100 - 10 //)</code>   - L181 - **Subtract** **Q** value from Register Address **P** and store the result to Register Address **P** <code C>G10L181 P100 Q10 (//Subtract 10 from Register #100 // #100=#100 - 10 //)</code>
-  - L182 - **Mul** Register Address **P** by **Q** value and store the iresult to Register Address **P** <code C>G10L180 P100 Q10 (//Multiply Register #100 by 10 // #100=#100 * 10 //)</code> +  - L182 - **Mul** Register Address **P** by **Q** value and store the iresult to Register Address **P** <code C>G10L182 P100 Q10 (//Multiply Register #100 by 10 // #100=#100 * 10 //)</code> 
-  - L183 - **Divide** Register Address **P** to **Q**value and store the result to Register Address **P** <code C>G10L180 P100 Q10 (//Divide Register #100 by 10 // #100=#100 / 10 //)</code>+  - L183 - **Divide** Register Address **P** to **Q**value and store the result to Register Address **P** <code C>G10L183 P100 Q10 (//Divide Register #100 by 10 // #100=#100 / 10 //)</code>
   - L184 - **Binary AND** value **Q** with Register Address **P** and store the result to Register Address **P** <code C>G10L184 P100 Q66 (//Binary AND Register #100 with 66 // #100=#100 & 66 //)</code>   - L184 - **Binary AND** value **Q** with Register Address **P** and store the result to Register Address **P** <code C>G10L184 P100 Q66 (//Binary AND Register #100 with 66 // #100=#100 & 66 //)</code>
   - L185 - **Binary OR** value **Q** with Register Address **P** and store the result to Register Address **P** <code C>G10L185 P100 Q66 (//Binary OR Register #100 with 66 // #100=#100 | 66 //)</code>   - L185 - **Binary OR** value **Q** with Register Address **P** and store the result to Register Address **P** <code C>G10L185 P100 Q66 (//Binary OR Register #100 with 66 // #100=#100 | 66 //)</code>
Line 197: Line 198:
   - L193 - **Divide** value from Register Address **P** to Register Address **Q** and store the result to Register Address **P** <code C>G10L193 P100 Q101 (//Divide Register #100 to Register #101 // #100=#100 / #101 //)</code>   - L193 - **Divide** value from Register Address **P** to Register Address **Q** and store the result to Register Address **P** <code C>G10L193 P100 Q101 (//Divide Register #100 to Register #101 // #100=#100 / #101 //)</code>
   - L194 - **ABS** calculate absolute value of Register Address **P** and store the result to Register Address **P** <code C>G10L194 P100 (//Absolute value of Register #100 // #100=ABS(#100) //)</code>   - L194 - **ABS** calculate absolute value of Register Address **P** and store the result to Register Address **P** <code C>G10L194 P100 (//Absolute value of Register #100 // #100=ABS(#100) //)</code>
 +  - L200 - trigonometric functions support, a command with the format "P_reg1 Q_reg2" where Register Address reg1 = sin(reg2)
 +  *  
 +    * 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,
 +
 +<code>N17 G97 S2500 M3
 +N18 G0 X14 Z1
 +N19 G92 S2500
 +N20 G96 S220 M3</code>
 +
 +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, both G92 and G50 work the same way if the "S" parameter is used. If the G92 command features an F-code parameter however, then the command is treaded as a threading command. 
 +
 +For example, 
 +
 +<code>G92 S2500</code>
 +and
 +<code>G50 S2500</code>
 +
 +should produce the same result (although some users may prefer G92 due to the general convention). However, a command such as 
 +
 +<code>G92 Z-12 X10 F1
 +G92 Z-12 X20 F1 L2 P99</code>
 +
 +is automatically recognized by the system as a threading command instead. 
 +
  
 ==== M07 - Plasma Dot Marking ==== ==== M07 - Plasma Dot Marking ====
Line 226: Line 266:
  
   g0moveA(0x0,0x4,marker_ihc_dot_height); //Z axis, ignition_height   g0moveA(0x0,0x4,marker_ihc_dot_height); //Z axis, ignition_height
-  timer=100;do{ timer--; }while(timer>0); //wait 0.1sec till motion started+  timer=200;do{ timer--; }while(timer>0); //wait 0.1sec till motion started
   do { code=gvarget(6060); }while(code!=0x4d);//wait till motion finished   do { code=gvarget(6060); }while(code!=0x4d);//wait till motion finished
  
Line 239: Line 279:
  
   g0moveA(0x0,0x4,2000); //Z axis, ignition_height 20mm up   g0moveA(0x0,0x4,2000); //Z axis, ignition_height 20mm up
-  timer=100;do{timer--;}while(timer>0); //pause 0.1sec for motion starts+  timer=200;do{timer--;}while(timer>0); //pause 0.1sec for motion starts
   do { code=gvarget(6060); }while(code!=0x4d);//wait till motion finished   do { code=gvarget(6060); }while(code!=0x4d);//wait till motion finished
  
Line 274: Line 314:
   {   {
     g0moveA(0x0,0x4,0-30000); //Z axis     g0moveA(0x0,0x4,0-30000); //Z axis
-    timer=100;do{timer--;}while(timer>0); //wait till motion started+    timer=200;do{timer--;}while(timer>0); //wait till motion started
     do{     do{
         code=gvarget(6060);         code=gvarget(6060);
Line 359: Line 399:
  
 </code> </code>
 +
 +==== G0G53 vs G1/G2/G3 commands ====
 +
 +//Keywords: Simulator Displacement Error, Critical Compiler Stop.//
 +
 +When using G0G53 commands in machine coordinates, the controller switches to the machine coordinate position and the program coordinates become undefined at that given moment as a result. This means that the G1/G2/G3 interpolation commands **cannot** be used under these circumstances (instead, G0 must be used).
 +
 +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</code>
 +
 +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</code>
 +
 +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.1569590510.txt.gz · Last modified: 2019/09/27 09:21 by ivan

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki