Share via Share via... Twitter LinkedIn Facebook Pinterest Telegram WhatsAppSend via e-MailPrintPermalink × Table of Contents 1. Supported G and M Codes 1.1 Supported G Codes 1.2 Supported M Codes 1.3 Other Codes “F” for “Feed” “S” for “Spindle Speed” “T” for “Tool” Notes 1.4 G-Code Comments 1.5 Block delete 1. Supported G and M Codes 1.1 Supported G Codes The following table describes supported G-Code commands. The G-codes and M-codes called in the same line of a G-code file are executed accordingly to G Code Order of Execution. In the following axes means one or more of X, Y, Z, A, B, C, along with a corresponding floating-point value for a specified axis. Gcode Parameters Command Description G0 axes Straight traverse Traverse at maximum velocity. G1 axes F Straight feed Move at feed rate F. G2 axes F P IJK or R Clockwise arc feed Arc at feed rate F. G3 axes F P IJK or R Counterclockwise arc feed Arc at feed rate F. G4 P Dwell Pause for P seconds. G9 axes F Exact Stop (non-modal) Move at feed rate F and stop at the end. G10 L1 P axes Set Tool Table Entry Update the tool table adding/updating the tool info with the tool offset set by the user. Arguments: * P tool id * X tool offset X * Y tool offset Y * Z tool offset Z * D tool diameter * Q tool type * I tool parameter 1 * J tool parameter 2 * K tool parameter 3 * V tool slot: this should be specified only if the tool is not already present in the tool table. G10 L10 P axes Set Tool Table, Calculated, Workpiece Update the tool table adding/updating the tool info with the tool offset calculated by the G-code interpreter. * P tool id * X the X position that should be considered 0 when the tool is loaded and tool offset are used * Y the Y position that should be considered 0 when the tool is loaded and tool offset are used * Z the Z position that should be considered 0 when the tool is loaded and tool offset are used * D tool diameter * Q tool type * I tool parameter 1 * J tool parameter 2 * K tool parameter 3 * V tool slot: this should be specified only if the tool is not already present in the tool table. G10 L2 P axes Coordinate System Origin Setting G10 L2 offsets the origin of the coordinate system specified by P to the value of the axis word. The offset is from the machine origin established during homing. The offset value will replace any current offsets in effect for the coordinate system specified. Axis words not used will not be changed. G10 L20 P axes Coordinate Origin Setting Calculated G10 L20 is similar to G10 L2 except that instead of setting the WCS origin offset, it calculates and sets the values that makes the current coordinates corresponds to the specified arguments. G10 L100 P<parameter> V<value> Set the value of some special parameters G15 Switch to Cartesian coordinates G16 Switch to polar coordinates G17 Select XY arc plane G18 Select XZ arc plane G19 Select YZ arc plane G20 Select inches mode All G-code from this point on will be interpreted in inches G21 Select mm mode All G-code from this point on will be interpreted in millimetres G28 axes Go to G28 position Optional axes specify an intermediate point G28.1 Set G28 position Store the current machine position so that it will be used by G28 G30 axes Go to G30 position Optional axes specify an intermediate point G30.1 Set G30 position Store the current machine position so that it will be used by G30 G38.2 G38.3 G38.4 G38.5 axes Probing G40 Disable Cutter Compensation G41 D I Enable Cutter Compensation left of programmed path G41.1 D L Enable Dynamic Cutter Compensation left of programmed path G42 D I Enable Cutter Compensation right of programmed path G42.1 D L Enable Dynamic Cutter Compensation right of programmed path G43 H Enable Tool Length Compensation H argument is optional, if it is not specified the current tool is used. G43.1 X Y Z Enable Dynamic Tool Length Compensation Tool compensation is enabled considering the specified offsets X, Y and Z. The arguments X,Y and Z are optional but at least one should be specified. G43.2 H Apply additional Tool Length Offset Add the offsets due to the tool specified with the H argument to the offsets already in use. G43.4 H Enable RTCP feature Enable Rotation tool center point control. (See 1. RTCP) G43.7 H <X> <Y> <Z> Enable RTCP feature and override tool offsets using user defined arguments G49 Cancel Tool Length Compensation and disable RTCP feature G50 Disable scaling G51 X Y Z and I J K or P Enable scaling G52 axes Local Work Shift The values entered are added to all work offsets G53 Select absolute coordinates Non-Modal: Applies only to current block G54 Select coord system 1 G54 is typically used as the “normal” coordinate system and reflects the machine position G55 Select coord system 2 G56 Select coord system 3 G57 Select coord system 4 G58 Select coord system 5 G59 Select coord system 6 G59.1 Select coord system 7 G59.2 Select coord system 8 G59.3 Select coord system 9 G61 Set exact path mode G61.1 Set exact stop mode Motion will stop between each G-code block G64 P Q Continuous path mode Results in minimum execution time allowing minimal trajectory deformation G65 P A B C … Macro call G66 P A B C … Macro modal call G67 Macro modal call cancel G68 X Y Z R Coordinate System Rotation G68.2 <X> <Y> <Z> I J K 3D plane rotation (arcs not supported) Rotate the reference plane in 3D so that G0,G1,G9 and cycles can be easily used on tilted planes. X ,Y,Z define the center of the rotation while I,J,K define the rotation around X, Y, Z. The order used to apply the rotation is always rotate around X, then Y, then Z. When G68.2 is active tool length compensation (G43, G43.1, …) can be enabled but tool radius compensation cannot be enabled. G69 Cancel Coordinate System Rotation G73 X Y Z R Q <L> High Speed Peck Drilling Cycle Chip Break Drilling Cycle G80 Cancel motion mode G81 X Y Z R L Drilling Cycle G82 X Y Z R L P Drilling Cycle, Dwell G83 X Y Z R L Q Peck Drilling Cycle G85 X Y Z R L Boring Cycle, Feed Out G86 X Y Z R L P Boring Cycle, Spindle Stop, Rapid Move Out G88 Boring Cycle, Spindle Stop, Manual Out G89 Boring Cycle, Dwell, Feed Out G90 Set absolute distance mode G90.1 Set absolute arc distance mode Absolute distance mode for I, J & K offsets. When G90.1 is in effect I and J both must be specified with G2/3 for the XY plane or J and K for the XZ plane or it is an error G91 Set incremental distance mode G91.1 Set incremental arc distance mode Default arc mode G92 axes Set origin offsets G92.1 Reset origin offsets Reset parameters 5211 - 5219 to zero but G92 keeps its current state. Parameter 5210 remains 1 or 0 depending on its value before calling G92.1. G92.2 Suspend origin offsets G92.3 Resume origin offsets Set the G92 offsets to the values saved in parameters 5211 to 5219. G93 Enable feed per inverse of time When this G code is processed the target feed is set to 60 (seconds) divided by the F<target feed> value. G94 Enable feed per minute When this G code is processed the target feed is set to 0 and should be specified again using F<target feed>. G98 Canned cycle return mode Initial Level Return In Canned Cycles set to initial Z G99 Canned cycle return mode Initial Level Return In Canned Cycles set to R parameter G100 P A B C … Internal PLC function Call G101 P Set the axes to be interpolated Request the axes specified by the P parameter to be interpolated. The P parameter is a bitmask where bit 1 represents X axis, bit 2 Y axis, …. G102 P Homing request Request the axes specified by the P parameter to be homed. The P parameter is a bitmask where bit 1 represents X axis, bit 2 Y axis, …. G103 V Set traverse rate The maximum speed used for G0 motion. Units are mm/min. Zero means use the maximum value allowed by the axes involved in the movement. G104 A D <J> Set interpolated motion dynamics Set the maximum acceleration and deceleration along the trajectory during interpolated motion. When A/D is set to 0 the maximum acceleration/deceleration allowed by the axes involved in the movement is used. Units are mm/s^2 if G21 is active and inches/s^2 if G20 is active. Example: G104 A100 D50 to set a maximum acceleration of 100 mm/s^2 and a maximum deceleration of 50 mm/s^2. J is optional and can be used to set the jerk in % from 0.0 to 100.0. 0 Means accelerate with a slower ramp, 100% means accelerate immediately. G200÷G499 A B C … User defined G codes User defined G codes require a user edited G-code file in macros folder with the G-code name (eg: g212.ngc). 1.2 Supported M Codes Mcode Parameters Command Description M0 Program Stop Current implementation place the CNC in PAUSE state. M1 Program Optional Stop Current implementation place the CNC in PAUSE state if the optional stop input is on. M2 Program End End a G-code program and reset the machine state: switch off I/O, mist, flood and spindle. M3 Start spindle clock wise M4 Start spindle counter clock wise M5 Stop spindle turning M6 Tool change See also User Tool Change Subprogram M7 Mist On M8 Flood On M9 Mist and Flood Off M17 Turn On Torch Height Control (THC) M18 Turn Off Torch Height Control (THC) M30 Pallet shuttle and program end If the correspondent settings is enabled the user G-code macro pallet_shuttle.ngc can be called. M47 Restart program execution M48 Enable the feed rate and spindle speed override controls M49 Disable the feed rate and spindle speed override controls M50 <P> Enable/Disable the feed rate override control. P parameter is optional and if it is not specified P0 is considered. Possible P values are: 0 disable feed override 1 enable feed override 2 enable feed override custom 1 3 enable feed override custom 2 M51 <P> Enable/Disable the spindle speed override control. Usage: M51 P1 (or M51) enable spindle speed override control and M51 P0 disable it. The P parameter is optional. M60 Pallet shuttle If the correspondent settings is enabled the user G-code macro pallet_shuttle.ngc can be called. M61 Q Set the current tool without performing a tool change. Could be called from user G-code defined tool change macro, see also User Tool Change Subprogram. M62 P Turn out ON M63 P Turn out OFF M66 P L Q Wait input Parameters: P: the number of the user input signal to be waited L: 0: waits for the selected input to reach the LOW state 1: waits for the selected input to reach the HIGH state 2: waits for the selected input to perform a FALL event 3: waits for the selected input to perform a RISE event 4: return immediately and the input value is stored in #5720 10 to 13: wait for the input to be LOW, HIGH, FALL or RISE and generate a CNC alarm if timeout elapses while waiting Q: timeout in seconds (optional) Notes: If the correspondent compiler setting is enabled the input value is stored in parameter #5720 and can be used in the following control flow statements (IF, WHILE, …). If the Q parameter is missing, the instruction waits until the condition is satisfied. M67 P Read analog input Work the same way of M66 but is used to handle analog inputs M68 P Q Set analog output Used instead of M62/M63 for analog outputs. Q argument is used to set the desired analog output value in percentage. M98 P L Call Subroutine Note: a named external subroutine can be called M99 Return from Subroutine M102 End Program without reset End a program but does not perform an automatic reset switching off mist, flood, spindle status, … M106 Execute PLC internal tool change procedure This M code is intended to be called by the user from the file named tool_change.ngc. This code inform the PLC to start the internal tool change procedure that can perform a few automatic actions not described by the procedure described using the G-code. See also User Tool Change Subprogram. M107 Inform the PLC that the tool change procedure written in the User Tool Change Subprogram has started. M108 Inform the PLC that the tool change procedure written in the User Tool Change Subprogram has ended. M109 P Q D Show user message M120 P Q D Show user media M166 P Read digital input group The parameter P identifies the group. This M code updates the parameters #5740- #5759 M167 P Read input group The parameter P identifies the group. This M code updates the parameters #5740- #5759 M200÷M299 A B C … User defined M codes User defined M codes require a user edited G-code file with the macro name and .ngc extension to be place in the directory <%appdata%/RosettaCNC-1>/machines/<machine_name>/macros (eg: m210.ngc). 1.3 Other Codes Simple G-code commands are used for setting the speed, feed, and tool parameters. “F” for “Feed” The F command sets the feed rate; the machine operates at the set feed rate when G1 is used, and subsequent G1 commands will execute at the set F value. If the feed rate (F) is not set once before the first G1 call, either an error will occur or the machine will operate at its “default” feed rate. An example of a valid F command: G1 F1500 X100 Y100 To see how RosettaCNC handled the feed rate when for single rotary axis moves or for mixed moves please check Feed Management “S” for “Spindle Speed” The S command sets the spindle speed, typically in revolutions per minute (RPM). An example of a valid S command: S10000 “T” for “Tool” The T command is used to set the id of the tool to be loaded with the M6 command. The typical syntax to load the tool with id 1 would be: M6 T1 Notes Setting the Tool Change Type option to Macro in the Board Settings the user can customize the tool change procedure. If the option is enabled the M06 command will look into the machine macros folder and execute the G-code file named tool_change.ngc. In this file the user can specify any supported G-code command to perform the tool change procedure as required by the specific machine. To see a reference implementation of the file tool_change.ngc please take a look to User Tool Change Subprogram. 1.4 G-Code Comments The following syntaxes are supported: (…) : simple comment between brackets ; : simple comment till the end of the line started with a semi column 1.5 Block delete Block Delete, also called Optional Skip, determines what happens when a line of code has a forward slash mark (/). In RosettaCNC integrated G-Code editor there is a dedicated icon to enable/disable this feature. When the feature is enabled and a line of G-Code begins with a forward slash the line is ignored and the execution skips to the next line of code. Last modified: 2022/08/24 09:29by cnc205