Marlin Laser Cutter G

advertisement
Marlin Laser Cutter G-Code Reference
G-Code Format
The G-Code format for the Marlin Laser Cutter software meets the
requirements of RS274, implanting a subset of the full control system.
The format of the command is
[N<line number>] <Command> [Parameters]
The line numbers are optional and have the form
Nxxx where xxx represents is an integer. The processor ignores line numbers
so the numeric part can be of arbitrary length and in any order. It is legal to
repeat line numbers. Typically line numbers are not required as there is no
procedural or conditional pro cessing of commands.
The format of the command is
<Letter><Numeric>
The commands accepted by the command processor are:




G – Move and cut operations.
M – Control Commands.
T – Tool selection.
F – Feed rate selection.
When a recognised command is passed to the processor over the serial link it
will respond with an acknowledgement – either “ok” for a success or an error
message. There is a limited amount of buffering on the command processor
so a new command should not be issued before a response to the previous
command has been received.
1
All parameters can be passed as either floating point in normal not scientific
values. Typically three or four digits after the decimal point are provided. All
commands are case sensitive.
Some of the commands implemented are specifically for the 3D printer
variant of the code. If issued these commands will give a positive response
but will not affect the operation of the cutter.
General Commands
G0 – Move
Description:
Parameters:
Move the head to the destination point without firing the
laser. The command allows the user to set the parameters for
the laser firing for subsequent move commands.
X<xx> - Sets the X position of the destination point
Y<yy> - Sets the Y position of the destination point
Z<zz> - Sets the Z position of the destination point. If there is
not a motorised stage this is ignored
E<ee> - Ignored – no extruder
F<ff> - Feed rate in units per second
S<ss> - Laser intensity in % (0 to 100%)
L<ll> - Laser fire duration in S for pulsed operation
P<pp> - Pulses per millimetre for pulsed operation
D<d> - Diagnostics mode on or off.
D0 = diagnostics off.
D1 = diagnostics on.
B<b> - Laser operating mode
B0 = Continuous mode
B1 = Pulsed mode
B2 = Raster mode
2
G1- Linear Cut
Description: Moves the laser in a straight line from the current point to
the destination point while cutting. The laser is turned on at
the start of the move and off at the end of the move.
Parameters:
X<xx> - Sets the X position of the destination point
Y<yy> - Sets the Y position of the destination point
Z<zz> - Sets the Z position of the destination point.
E<ee> - Ignored – no extruder
F<ff> - Feed rate in units per second
S<ss> - Laser intensity in % (0 to 100%)
L<ll> - Laser fire duration in S for pulsed operation
P<pp> - Pulses per millimetre for pulsed operation
D<d> - Diagnostics mode on or off.
D0 = diagnostics off.
D1 = diagnostics on.
B<b> - Laser operating mode
B0 = Continuous mode
B1 = Pulsed mode
B2 = Raster mode.
G2 – Cut Clockwise Arc
Description: Move in a clockwise arc. The move is with the current laser
state. If the arc is to be cut, then the laser must be on before
starting the cut. The arc is cut from the current position to the
destination position.
Parameters: X<xx> - Sets the X position of the destination point
Y<yy> - Sets the Y position of the destination point
Z<zz> - Sets the Z position of the destination point
E<ee> - Ignored – no extruder
I<ii> - Center X position offset from current position
J<jj> - Center y position offset from current position
3
G3 – Cut Anticlockwise Arc
Description: Move in an Anticlockwise arc. The move is with the current
laser state. If the arc is to be cut, then the laser must be on
before starting the cut. The arc is cut from the current
position to the destination position.
Parameters: X<xx> - Sets the X position of the destination point
Y<yy> - Sets the Y position of the destination point
Z<zz> - Sets the Z position of the destination point.
E<ee> - Ignored – no extruder
I<ii> - Center X position offset from current position
J<jj> - Center y position offset from current position
G4 – Delay
Description:
Parameters:
Notes:
Hold the head in the current position for the defined delay
P<pp> - Delay in milliseconds
S<ss> - Delay in seconds
If both P and S parameters are specified, the S parameter is
used.
G5 – Bezier Curve
Description: Move the head from the current position to the destination
position using an interpolated Bezier spline function with two
control points.
Parameters: X<xx> - Sets the X position of the destination point
Y<yy> - Sets the Y position of the destination point
I<ii> - X position of control point one
J<jj> - Y position of control point one
K<kk> - X position of control point two
L<ll> - Y position of control point two
G7 – Raster Line
Description: Carve a raster line for an image on the workpiece. The raster
is carved along the X direction. The Y position is adjusted on
4
Parameters:
completion of the line by the pixel height ready to carve the
next line.
L<ll> - Sets the length of the Raster Line in mm
N<nn> - Sets the direction of the raster line:
1 = Positive
0 = Negative
D<dd> - Base64 encoded data for the raster line
G10 – Retract Z Axis
Description: Retract the Z axis and the extruder – not used on the laser
cutter
G11 – Recover from Z Axis Retract
Description: Reposition the Z axis and reload the extruder – not used on
the laser cutter
G28 – Home All Axes
Description: Move all axes to the home position simultaneously. The
command terminates when all axes are in the home position.
G90 – Set Absolute Coordinate Mode
Description: Sets the system to operate in absolute mode. All coordinates
are taken from the home position
G91 – Set relative Coordinate mode
Description: Sets the system to operate in relative coordinate mode. All
coordinates are taken from the reference position
G92 – Set Current Position
Description: Sets the coordinates of the current position to the supplied
values. This effectively defines the relative origin for the
system. If no parameters are provided the position is set to
(0,0,0,0).
5
Parameters:
X<xx> - X coordinate of the current position
Y<yy> - Y coordinate of the current position
Z<zz> - Z coordinate of the current position
M0 – Unconditional Stop
Description: The command is only available when ULTIPANEL is defined in
the code build. If no parameters are given the machine stops
until the button on the LCD panel is pressed, otherwise it
stops for the specified time. If both P and S parameters are
specified the S parameter is used.
Parameters: P<pp> set the delay time in milliseconds
S<ss> set the delay time in seconds.
M1 – Conditional Stop
Description:
See M0
M3 – Set Laser Firing Parameters & Fire Laser
Description: Sets the parameters for laser firing for subsequent operations
and fire the laser. This will burn a large hole in the workpiece
and may cause a fire if the head does not start moving as
soon as the M3 command is processed. If no parameters are
set, the laser is switched on with the current settings.
Parameters: S<ss> - Laser intensity in % (0 to 100%)
L<ll> - Laser fire duration in S for pulsed operation
P<pp> - Pulses per millimetre for pulsed operation
D<d> - Diagnostics mode on or off.
D0 = diagnostics off.
D1 = diagnostics on.
B<b> - Laser operating mode
B0 = Continuous mode
B1 = Pulsed mode
B2 = Raster mode
6
M5 – Clear Laser
Description: Turns the laser off.
M17 – Enable All Motors
Description: Enables all stepper motors for use
M18 – Disable Selected Motors
Description: Disable the selected motors. If a time is set, then the motors
are disabled for that length of time, otherwise the motors are
disabled until re-enabled by an M17 command. If no axis
parameter is specified all stepper motors are disabled
Parameters: S<ss> - Disable time in seconds
X – Disable the X-axis motor
Y – Disable the Y-axis motor
Z – Disable the Z-axis motor
E – Disable the Extruder motors (not used on laser)
M20 – List SD Card Contents
Description:
Lists the contents of the SD Card to the serial port.
M21 – Init SD-Card
Description:
Initialises the SD Card ready for use
M22 – Release SD Card
Description: The SD card is released from operation and un-mounted. The
card can then be safely removed.
M23 – Select File
Description:
Selects the specified file for operation
Parameters: The command should specify the filename to be used in 8.3
format.
7
M24 – Start SD Card File Print
Description: Starts printing from the selected file. There is an error if a file
is not selected. If the printing has been paused using M25,
printing is restarted.
M25 – Pause SD Card Print
Description: Pauses the current print from SD card. It can be resumed with
M24.
M26 – Set SD Card Index
Description: Positions the SD Card file pointer to the position specified in
the command. If no index is specified no action is taken
Parameters: S<ss> - Position of the file pointer in bytes
M27 – Get SD Card Status
Description: Returns the file pointer position and length of the currently
selected file in bytes
M28 – Start Writing to File
Description: Opens the specified file for writing
Parameters: The file to be opened for writing in 8.3 format
M29 – Stop Writing File
Description: In the current version of Marlin this performs no action.
M30 – Delete File
Description: Deletes the file specified from the SD Card
Parameters:
The file to be deleted in 8.3 format
M31 – Return Print Time
Description: Returns the time since the current print started or the last
M109 command
8
M32 – Print Selected File
Description: Prints the specified file. This performs the same function as
M23 followed by M24
Parameters: File to print in 8.3 format.
M42 – Force Pin Status
Description: Force a specific I/O pin to the given state. If no pin is specified
then the state of the LED on the RAMPS board is set.
Parameters: P<pp> - Pin to be set
S<ss> - Value to be written to the pin. If no S parameter is
passed, the command is ignored.
M80 – Turn Laser Peripherals On
Description: Turn on the laser peripherals (Air Assist, Extract fan etc). The
actual pin used depends on the CPU. This function also turns
on the power supply on a 3D printer.
M81 – Turn Laser Peripherals Off
Description: Turns the laser peripherals off. This function is also used to
turn the power supply off on a 3D printer and disables the
stepper motors.
M82 – Set Absolute Coordinate Mode
Description: Sets the cutter to absolute coordinate mode – all coordinates
are taken from the bed origin. This is equivalent to a G90
command.
M83 – Set Relative Coordinate Mode
Description: Sets the cutter to relative coordinate mode – all coordinates
are taken from the origin point. This is equivalent to a G91
command.
M84 – Disable Selected Motors
Description:
See M18. This command is retained for compatibility.
9
M85 – Set Inactivity Timeout
Description: Sets the inactivity timeout. On timeout, the equipment shuts
down. If the timeout is set to 0 it is disabled
Parameters: S<ss> - timeout period in seconds
M92 – Set The Number of Steps Per Unit
Description: Set the number of steps per unit length of motion. This needs
to be set if the units are changed.
Parameters: X<xx> - Set the steps for the X Axis.
Y<yy> - Set the steps for the Y Axis
Z<zz> - Set the steps for the Z Axis
M104 – Set Hot End Target Temperature
Description: Not used on Laser cutter
M105 – Read Current Temperatures
Description: Not used on Laser cutter
M106 – Turn Fan On
Description: Turn on the system fan if it is set up to be controlled.
Parameters: S<ss> Speed to be used (0 to 255). If no parameter is specified
the fan is run at full speed.
M107 – Turn Fan Off
Description: Turns off the system fan if it is set up to be controlled
M109 – Wait For Extruder Temperature
Description: Not used on Laser cutter
M114 – Return Current Position
Description: Returns the current position of the head in coordinates and in
steps.
10
M115 – Return Version
Description: Returns the Type description of the system, software versions
and system capability.
M117 – Display Message on LCD
Description: Displays the message passed as a parameter to the command on
the LCD. The string is terminated by either \0 or a line end
character sequence.
M119 – Return the Endstop Status
Description: Returns the state of the home and limit endstops (if enabled)
to the serial port.
M120 – Disable Endstops
Description: Disables the end stops to allow the carriage to overrun the
limits
M121 – Enable the Endstops
Description: Enable the end stops on the carriage.
M126 – Solenoid Air Valve On
Description: Not used on Laser cutter
M127 – Solenoid Air Valve Off
Description: Not used on Laser cutter
M128 – Set EtoP Pressure Solenoid Valve On
Description: Not used on Laser cutter
M129 – Set EtoP Pressure Solenoid Valve On
Description: Not used on Laser cutter
M140 – Set Bed Temperature
Description: Not used on Laser cutter
11
M190 – Wait For Bed Temperature
Description: Not used on Laser cutter
M201 – Set Maximum Acceleration
Description: Set the maximum rate of acceleration for each channel in
units/second2.
Parameters: X<xx> Acceleration for the X Axis
Y<yy> Acceleration for the X Axis
Z<zz> Acceleration for the X Axis
E<ee> Not used on laser cutter
M202 – Set Maximum Acceleration
Description: Set the maximum rate of acceleration for each axis in
units/second2. This command is not used for GRBL Gen6 or
Sprinter.
Parameters: X<xx> Acceleration for the X-axis
Y<yy> Acceleration for the X-axis
Z<zz> Acceleration for the X-axis
E<ee> Not used on laser cutter
M203 – Set Maximum Feed rate
Description: Set the maximum feed rate for each axis in mm/second.
Parameters: X<xx> Feed rate for the X-axis
Y<yy> Feed rate for the X-axis
Z<zz> Feed rate for the X-axis
E<ee> Not used on laser cutter
M204 – Set Default Acceleration
Description: Sets the default acceleration to be used by the driver
Parameters: S<ss> - Acceleration for stage moves
T<tt> - Acceleration for Filament moves. Not used on Laser
Cutter
12
M205 – Set Advanced Motion Parameters
Description: Set the advanced control parameters for the motion system.
Parameters: S<ss> Minimum feed rate in mm/S
T<tt> Minimum travel feed rate
B<bb> Minimum segment time
X <xx> Maximum XY jerk value
Z<xx> Maximum Z axis jerk – Not used on laser cutter
E<ee> Maximum Extruder Jerk – Not Used on laser cutter
M206 – Set Additional Homeing Offset
Description: Sets the additional homeing offset. This offset is added to the
physical home positions
Parameters: X<xx> Additional offset for the X axis
Y<yy> Additional offset for the Y axis
Z<zz> Additional offset for the Z axis
M207 – Set Retract Length, Rate & Lift
Description: Not used on laser cutter
M208 – Set Retract Recover
Description: Not used on laser cutter
M209 – Enable Automatic Retract
Description: Not used on laser cutter
M218 – Set Hot End Offset
Description: Not used on laser cutter
M220 – Set Speed Override Factor
Description: Allows the user to set an override factor to adjust the
federate set in the G-code
Parameters: <S>ss Speed override multiplication factor in percent
M221 – Set Extruder Speed Override Factor
Description: Not used on laser cutter
13
M240 – Camera Trigger
Description: Fires an attached camera by emulating a Canon RC-1 remote
interface.
M250 – Set Display Contrast
Description: Set the contrast of the HMI display. Applies only to displays
with remote contrast adjustment
Parameters: C<cc> Contrast value in the range 0 to 63
M280 – Set Servo Position
Description: Set the position of an attached servo
Parameters: P<pp> Index number of the servo
S<ss> Servo position in microseconds or degrees. If the value
is less than 544 the angle is in degrees otherwise it is in
microseconds
M300 – Sound Beeper
Description: Sounds the beeper on the HMI.
Parameters: S<ss> Tone frequency in Hz
P<pp> Tone duration in mS
M301 – Set Extruder PID Parameters
Description: Not used on laser cutter
M302 – Allow cold extrude or set extrude temp
Description: Not used on laser cutter
M303 - Autotune PID
Description: Not used on laser cutter
M304 – Set Bed PID Parameters
Description: Not used on laser cutter
14
M350 – Set Microstepping Mode
Description: Sets the microstepping mode for the selected axis. The
stepping values can be:
1 – Full Stepping Mode
2 – ½ Stepping Mode
4 – ¼ Stepping Mode
8 – 1/8 Stepping Mode
16 – 1/16 Stepping mode
Parameters: X<xx> Set the stepping mode for the X Axis
Y<yy> Set the stepping mode for the Y Axis
Z<zz> Set the stepping mode for the Z Axis
S<ss> Set the stepping mode for all axes
M351 – Toggle MS1 & MS2
Description: Allows the user to dirve the stepper motors directly by
manipulating the MS1 and MS 2 Pins. The value passed in the
axis parameter determines the state of the selected pin: 0
sets the pin low, 1 sets the pin high
Parameters: S<ss> – selects whether MS1 or MS2 is controlled
S1 Toggle MS1
S2 Toggle MS2
X<xx> Control the X Axis
Y<yy> Control the Y Axis
Z<zz> Control the Z Axis
M400 – Finish All Moves
Description: Hold all other operations until all queued operations are
finished. The command will return OK when operations are
completed
M500 – Store EEPROM Parameters
Description: Write the current parameters to the internal EEPROM
15
M501 – Read Settings From EEPROM
Description: Read the stored settings from EEPROM
M502 – Revert to Default Settings
Description: Revert the system to the default settings hard-coded in the
firmware
M503 –Print Current Settings
Description: Print the current setup to the serial port
M540 – Set Printing Abort on Endstop
Description: Set whether printing is aborted on hitting an endstop or not
Parameters: S<ss> Sets whether abort is enabled or not
S0 = Abort on Endstop disabled
S1 = Abort on Endstop enabled
M600 – Pause For Filament Change
Description: Not used on laser cutter
M649 – Set Laser Options
Description:
Set the operating parameters for the laser without firing the
laser.
Parameters: S<ss> - Laser intensity in % (0 to 100%)
L<ll> - Laser fire duration in S for pulsed operation
P<pp> - Pulses per millimetre for pulsed operation
D<d> - Diagnostics mode on or off.
D0 = diagnostics off.
D1 = diagnostics on.
B<b> - Laser operating mode
B0 = Continuous mode
B1 = Pulsed mode
B2 = Raster mode
M650 – Set Laser Peel Parameters
Description: Not used on laser cutter
16
M651 – Perform Peel Operation
Description: Not used on laser cutter
M907 – Set Stepper Motor Current By Axis
Description: Sets the maximum operating current for the stepper drives if
digital potentiometers are installed. The current is set from 0
to 255 (minimum to maximum)
Parameters: X<xx> X Axis current limit
Y<yy> Y Axis current limit
Z<zz> Z Axis current limit
E<ee> Extruder current limit
M908 – Set Stepper motor Current Limit By Index
Description: Sets the current limit by motor drive index if digital
potentiometers are installed
Parameters: P<pp> Index of the motor to be set
S<ss> Current Limit to be used 0 = minimum, 255 = maximum
M928 – Open File For Logging
Description: Opens a file for data logging
Parameters: Filename of the log-file in 8.3 format
M999 – Restart After Stop
Description: Restarts the operation of the system after a stop
T – Extruder Control
Description: Not used on laser cutter.
17
Download