Was ist M-Code?


Ähnlich wie der G-Code beginnt auch der M-Code mit dem Buchstaben "M".

Der M-Code repräsentiert eine Reihe von Hilfsbefehlen, die alle nicht-geometrischen Aktionen der Maschine steuern, wie beispielsweise das Anhalten von Programmen, die Drehzahl der Lüfter und das Abschalten des 3D-Druckers beim Auftreten von Problemen.

Wie bei den G-Codes gibt es auch bei den M-Codes kleinere Unterschiede zwischen den verschiedenen 3D-Druckern. Einige erlauben das Weglassen der Null zwischen dem Buchstaben und der Zahl, andere nicht.

Hier nun die M-Codes der Marlin Firmware im Detail:

M0-M1 - Unconditional stop

Stop and wait for user

M3 - Spindle CW / Laser On

Set the spindle CW speed or laser power

M4 - Spindle CCW / Laser On

Set the spindle CCW speed or laser power

M5 - Spindle / Laser Off

Turn off spindle or laser

M7-M9 - Coolant Controls

Turn mist or flood coolant on / off

M16 - Expected Printer Check

Prevent G-code usage on the wrong machine

M17 - Enable Steppers

Enable steppers

M18, M84 - Disable steppers

Disable steppers (same as M84)

M20 - List SD Card

List the contents of the SD Card

M21 - Init SD card

Attempt to detect an SD card in the slot

M22 - Release SD card

Simulate ejection of the SD card

M23 - Select SD file

Select an SD file to be executed

M24 - Start or Resume SD print

Start or resume a file selected with ['M23'](/docs/gcode/M023.html)

M25 - Pause SD print

Pause printing from the SD card

M26 - Set SD position

Set the SD read position

M27 - Report SD print status

Print SD progress to serial

M28 - Start SD write

Start writing to a file on the SD card

M29 - Stop SD write

Stop writing the file, end logging

M30 - Delete SD file

Delete a specified file from SD

M31 - Print time

Report the current print time

M32 - Select and Start

Begin an SD print from a file

M33 - Get Long Path

Convert a short pathname to a long pathname

M34 - SDCard Sorting

Set SDCard file sorting options

M42 - Set Pin State

Set an analog or digital pin to a specified state

M43 T - Toggle Pins

Get information about pins

M43 - Debug Pins

Get information about pins

M48 - Probe Accuracy Test

Measure Z Probe repeatability

M73 - Set Print Progress

Set current print progress percentage for LCD

M75 - Start Print Job Timer

Start the print job timer

M76 - Pause Print Job

Pause the print job timer

M77 - Stop Print Job Timer

Stop the print job timer

M78 - Print Job Stats

Print statistics about print jobs

M80 - Power On

Turn on the power supply

M81 - Power Off

Turn off the power supply

M82 - E Absolute

Set E to absolute positioning

M83 - E Relative

Set E to relative positioning

M85 - Inactivity Shutdown

Set the inactivity timeout

M92 - Set Axis Steps-per-unit

Set the number of steps-per-mm or steps-per-inch

M100 - Free Memory

Observe memory used by code

M1000 - Internal Use Only

Resume from Power Loss

M1001 - Internal Use Only

Run SD Print Finishing Actions

M104 - Set Hotend Temperature

Set a new target hot end temperature

M105 - Report Temperatures

Send a temperature report to the host

M106 - Set Fan Speed

Turn on the fan and set its speed

M107 - Fan Off

Turn off a fan

M108 - Break and Continue

Break out of the current waiting loop

M109 - Wait for Hotend Temperature

Wait for the hot end to reach its target

M110 - Set Line Number

Set the current line number

M111 - Debug Level

Report and optionally set the debug flags

M112 - Emergency Stop

Shut everything down and halt the machine

M113 - Host Keepalive

Get or set the host keepalive interval

M114 - Get Current Position

Report the current tool position to the host

M115 - Firmware Info

Print the firmware info and capabilities

M117 - Set LCD Message

Set the message line on the LCD

M118 - Serial print

Send text to serial

M119 - Endstop States

Report endstop and probe states to the host

M120 - Enable Endstops

Enable endstops and keep them enabled when not homing

M121 - Disable Endstops

Disable endstops and keep them enabled when not homing

M122 - TMC Debugging

Get TMC Debug Info

M125 - Park Head

Save current position and move to filament change position

M126 - Baricuda 1 Open

Open the valve for Baricuda 1

M127 - Baricuda 1 Close

Close the valve for Baricuda 1

M128 - Baricuda 2 Open

Open the valve for Baricuda 2

M129 - Baricuda 2 Close

Close the valve for Baricuda 2

M140 - Set Bed Temperature

Set a new target bed temperature

M141 - Set Chamber Temperature

Set a new target chamber temperature

M145 - Set Material Preset

Set material presets in the LCD menu

M149 - Set Temperature Units

Set temperature units to Celsius, Fahrenheit, or Kelvin

M150 - Set RGB(W) Color

Set the color of the RGB(W) LED, backlight, or LED strip

M155 - Temperature Auto-Report

Auto-report temperatures to host periodically

M163 - Set Mix Factor

Set a single mix factor for a mixing extruder

M164 - Save Mix

Save the current mix as a virtual tool

M165 - Set Mix

Set all mix factors for the mixing extruder

M166 - Gradient Mix

Set a Gradient Mix

M190 - Wait for Bed Temperature

Wait for the bed to reach target temperature

M191 - Wait for Chamber Temperature

Wait for the chamber to reach target temperature

M192 - Wait for Probe temperature

Wait for the probe temperature sensor to reach a target

M200 - Set Filament Diameter

Set the diameter for volumetric extrusion

M201 - Set Print Max Acceleration

Set maximum acceleration for print moves one or more axes

M203 - Set Max Feedrate

Set maximum feedrate for one or more axes

M204 - Set Starting Acceleration

Set the starting acceleration for moves by type

M205 - Set Advanced Settings

Set some advanced settings related to movement

M206 - Set Home Offsets

Apply a persistent offset

M207 - Set Firmware Retraction

Set options for firmware-based retraction

M208 - Firmware Recover

Firmware-retraction recover settings

M209 - Set Auto Retract

Enable / disable auto-retraction

M211 - Software Endstops

Set and/or get the software endstops state

M217 - Filament swap parameters

Set length and speed for filament swapping

M218 - Set Hotend Offset

Set the offset of a hotend (from hotend 0)

M220 - Set Feedrate Percentage

Set the global feedrate percentage

M221 - Set Flow Percentage

set the flow percentage, which applies to all E moves

M226 - Wait for Pin State

Wait for a pin to have a given state

M240 - Trigger Camera

Trigger a camera shutter

M250 - LCD Contrast

Set and/or get the LCD contrast

M260 - I2C Send

Send data to the I2C bus

M261 - I2C Request

Request and echo bytes from the I2C bus

M280 - Servo Position

Set or get a servo position

M281 - Edit Servo Angles

Set servo deploy and/or stow angles

M290 - Babystep

Babystep one or more axes

M300 - Play Tone

Play a single tone, buzz, or beep

M301 - Set Hotend PID

Set PID values for a hotend

M302 - Cold Extrude

Set minimum extrusion temperature, allow cold extrusion

M303 - PID autotune

Auto-tune the PID system to find stable values

M304 - Set Bed PID

Set PID values for the heated bed

M305 - User Thermistor Parameters

Set (or report) custom thermistor parameters

M350 - Set micro-stepping

Set micro-stepping for drivers that support it

M351 - Set Microstep Pins

Directly set the micro-stepping pins

M355 - Case Light Control

Turn the case light on or off, set brightness

M360 - SCARA Theta A

Move to Theta A

M361 - SCARA Theta-B

Move to Theta-B

M362 - SCARA Psi-A

Move to Psi-A

M363 - SCARA Psi-B

Move to Psi-B

M364 - SCARA Psi-C

Move to Psi-C

M380 - Activate Solenoid


M381 - Deactivate Solenoids

Deactivate all extruder solenoids

M400 - Finish Moves

Wait for all moves to finish

M401 - Deploy Probe

Deploy the bed probe

M402 - Stow Probe

Stow the bed probe

M403 - MMU2 Filament Type

Set filament type for Multi-Material Unit 2.0

M404 - Set Filament Diameter

Set the nominal diameter for filament width sensor auto-flow

M405 - Filament Width Sensor On

Enable filament width sensor flow control

M406 - Filament Width Sensor Off

Disable filament width sensor flow control

M407 - Filament Width

Report the measured filament width

M410 - Quickstop

Stop all steppers instantly

M412 - Filament Runout

Enable / disable filament runout detection

M413 - Power-loss Recovery

Enable / disable power-loss recovery

M420 - Bed Leveling State

Get and/or set bed leveling state and parameters

M421 - Set Mesh Value

Set a single mesh Z height

M422 - Set Z Motor XY

Set a Z motor position for G34 Auto-Alignment

M425 - Backlash compensation

Enable and tune backlash compensation

M428 - Home Offsets Here

Set home offsets based on current position

M430 - Power Monitor

Read and display current (A), voltage (V), and power (W)

M486 - Cancel Objects

Identify and cancel objects

M500 - Save Settings

Save settings to EEPROM

M501 - Restore Settings

Restore settings from EEPROM

M502 - Factory Reset

Restore all settings to factory defaults

M503 - Report Settings

Report all settings that may be saved to EEPROM

M504 - Validate EEPROM contents

Validate the contents of the EEPROM

M510 - Lock Machine

Lock the machine if it has a passcode

M511 - Unlock Machine

Unlock the machine if it has a passcode

M512 - Set Passcode

Set a numeric passcode for locking the machine

M524 - Abort SD print

Abort an SD print started with ['M24'](/docs/gcode/M024.html)

M540 - Endstops Abort SD

Abort SD printing when an endstop is triggered

M569 - Set TMC stepping mode

Toggle stealthChop

M575 - Serial baud rate

Change the serial baud rate

M600 - Filament Change

Automatically change filament

M603 - Configure Filament Change

Configure automatic filament change parameters

M605 - Dual Nozzle Mode

Set the behavior mode for dual nozzles

M665 - SCARA Configuration

Set SCARA geometry values

M665 - Delta Configuration

Set delta geometry values

M666 - Set dual endstop offsets

Set dual endstop offsets

M666 - Set Delta endstop adjustments

Set Delta endstop adjustments

M672 - Test Speed Warning

Set/clear Duet Smart Effector sensitivity

M701 - Load filament

Load filament

M702 - Unload filament

Unload filament

M710 - Controller Fan settings

Set or report controller fan settings

M7219 - MAX7219 Control

Control Max7219 Segmented LEDs

M810-M819 - G-code macros

Set/execute one of ten G-code macros

M851 - XYZ Probe Offset

Set the Z probe XYZ offset from nozzle

M852 - Bed Skew Compensation

Misalignment in the XYZ axes

M860-M869 - I2C Position Encoders

I2C position encoders for closed loop control

M871 - Probe temperature config

Configure probe temperature compensation

M876 - Handle Prompt Response

Handle Host prompt responses

M900 - Linear Advance Factor

Get and set Linear Advance K value

M906 - TMC Motor Current

Set the motor current (in milliamps)

M907 - Set Motor Current

Set motor current via digital trimpot

M908 - Set Trimpot Pins

Set a digital trimpot directly

M909 - DAC Print Values

Report DAC current values to host

M910 - Commit DAC to EEPROM

Commit digipot/DAC value to external EEPROM

M911 - TMC OT Pre-Warn Condition

Driver overtemperature pre-warn condition

M912 - Clear TMC OT Pre-Warn

Clear overtemperature pre-warn condition flag

M913 - Set Hybrid Threshold Speed

TMC driver switching to spreadCycle

M914 - TMC Bump Sensitivity

Set sensorless homing sensitivity

M915 - TMC Z axis calibration

Align ends of the Z axis and test torque

M916 - L6474 Thermal Warning Test

Find L6474 drive level (KVAL_HOLD) threshold

M917 - L6474 Overcurrent Warning Test

Find L6474 minimum current thresholds

M918 - L6474 Speed Warning Test

Find L6474 speed threshold

M928 - Start SD Logging

Log serial input to an SD file

M951 - Magnetic Parking Extruder

Set / report Magnetic Parking Extruder settings

M993-M994 - SD / SPI Flash

load or back up SPI Flash and SD

M995 - Touch Screen Calibration

Touch screen calibration for TFT display

M997 - Firmware update

Perform in-application firmware update

M999 - STOP Restart

Return the machine to Running state

T0-T6 - Select Tool

Switch to the specified tool