3D printer m codes


M Codes - ReplicatorG

Main

  • About
  • Download
  • Installation
  • Usage
  • Drivers

Reference

  • Primer
  • G Codes
  • M Codes
  • Generators

Development

  • Development Mailing List
  • Building ReplicatorG
  • Reporting Bugs

Friends

  • RepRap
  • Arduino
  • Processing
  • NYC Resistor
  • Thingiverse
  • MakerBot Industries

Coded by:

  • Zach Hoeken
  • Marius Kintel
  • Adam Mayer
  • Matt Mets

M Codes

This page presents a summary of M codes used by ReplicatorG. M codes are very protean and flexible; many are RepRap or MakerBot specific.

The following extra M-Codes were defined for RepRap:

  • M101 Extruder on, fwd
  • M102 Extruder on, reverse
  • M103 Extruder off
  • M104 Snn set temperature in degrees Celsius
  • M105 get extruder temperature
  • M106 turn fan on
  • M107 turn fan off
  • M108 Set Extruder's Max Speed (Rnnn = RPM, Pnnn = PWM)
  • M109 Snnn set build platform temperature in degrees Celsuis
  • M110 Snnn set chamber temperature in degrees Celsius
  • M120, M121, M122 Snnn set the PID gain for the temperature regulator (not currently supported by ReplicatorG)
  • M123, M124 Snnn set iMax and iMin windup guard for the PID controller (not currently supported by ReplicatorG)
  • M128 get position
  • M129 get range (not currently supported by ReplicatorG)
  • M130 set range (not currently supported by ReplicatorG)
  • M200 reset driver
  • M202 clear buffer (not currently supported by ReplicatorG)
  • M300 Snnn set servo 1 position
  • M301 Snnn set servo 2 position

Other M codes understood by ReplicatorG

  • M0 Unconditional Halt (not supported on SD)
  • M1 Optional Halt (not supported on SD)
  • M2 End program
  • M3 spindle on, CW
  • M4 spindle on, CCW
  • M5 spindle off
  • M6 Tool change. This code waits until the toolhead is ready before proceeding. This is often used to wait for a toolhead to reach the its set temperature before beginning a print. ReplicatorG also supports giving a timeout with M6 P<secs>.
  • M7 coolant A on (flood coolant)
  • M8 cooland B on (mist coolant)
  • M9 all coolants off
  • M10 close clamp
  • M11 open clamp
  • M13 spindle CW and coolant A on
  • M14 spindle CCW and coolant A on
  • M17 enable motor(s)
  • M18 disable motor(s)
  • M21 open collet
  • M22 close collet
  • M30 program rewind
  • M40-M46 change gear ratio (0 - 6)
  • M50 read spindle speed
  • M70 Display message on machine, with optional timeout specified by P-code in seconds
    • Ex.: M70 P10 (Display this text for ten seconds)
  • M71 Pause activity and display message, resuming build on button push. Optional timeout specified by P-code in seconds. If timeout is specified and no button is pushed, machine should shut down or reset.
    • Ex.: M71 (Please insert motor into assembly and push a button.)
    • Ex.: M71 P20 (Machine will reset in twenty seconds!)
  • M72 Play a song or tone defined by the machine, by a P-code specifying a song type. Default songs are Error Sound (P0), a Ta-da sound (P1), and a warning sound (P2). all other sounds are user or machine specific, with P2 the default for unknown sounds.
    • Ex M72 P1 (Machine will play a 'TaDa' song!)
  • M73 Manually set build percentage. Valid P values are 0 to 100, values over 100 are rounded down to 100
    • Ex M73 P10 (Set build percent to 10% )
  • M126 valve open (acceleration on for subsequent instructions in the Jetty Firmware)
  • M127 valve close (acceleration off for subsequent instructions in the Jetty Firmware)
  • M310 (filepath) logging (see below)
  • M311 stop logging (see below)
  • M312 (message) log message (see below)
  • M320 acceleration on for subsequent instructions (Replicator/MightyBoard)
  • M321 acceleration off for subsequent instructions (Replicator/MightyBoard)
  • M322 Znn Pause@ZPos (Sailfish Only)

Logging in ReplicatorG

ReplicatorG 26 and later will feature basic logging functionality through M codes. You can experiment with this feature by checking out the "temperature_log" branch in the git repository.

M310 (FILE_PATH)
Start logging to the file specified by "FILE_PATH". The parenthesis are necessary!
M311
Stop logging
M312 (MESSAGE)
Log the message text to the logging file.

Status messages will be logged to the file once logging is turned on; this means you can log temperature data. NB: you must turn on "monitor temperature" in your preferences to monitor the toolheads! The status of all configured toolheads will be dumped to the log file at one second intervals.

Example:

(This will log 5 seconds of temperature data on all configured tools) M310 (test.log) M312 (--Start logging--) M104 S225 T0 (set extruder temperature) G04 P5000 M104 S0 T0 M312 (--End logging--) M311 

Other examples

(run toolhead 0 for 5 seconds)
G21 (set units to mm)
G90 (set positioning to absolute)
M108 T0 R1. 98 (set extruder speed)
M103 T0 (Make sure extruder is off)
M104 S225 T0 (set extruder temperature)
M6 T0 (wait for toolhead parts, nozzle, HBP, etc., to reach temperature)
M101 T0 (Extruder on, forward)
G04 P5000 (Wait t/1000 seconds)
M103 T0 (Extruder off)
M104 S0 T0 (set extruder temperature)

(run toolhead 1 for 6 seconds)
M108 T1 R1.98 (set extruder speed)
M103 T1 (Make sure extruder is off)
M104 S225 T1 (set extruder temperature)
M6 T1 (wait for toolhead parts, nozzle, HBP, etc., to reach temperature)
M101 T1 (Extruder on, forward)
G04 P6000 (Wait t/1000 seconds)
M103 T1 (Extruder off)
M104 S0 T1 (set extruder temperature)

M codes used by the Jetty Firmware but not understood by ReplicatorG

The following M codes are used by the Jetty Firmware and are documented at Jetty M Codes. With the exception of M126, M127 and M200, they are not presently supported by the standard ReplicatorG releases. Versions of ReplicatorG which understand these M codes are available as part of Thing 17855 at Thingiverse. A number of these M codes are also supported by the Marlin firmware.

  • M126 use acceleration for subsequent instructions
  • M127 disable acceleration for subsequent instructions
  • M201 set maximum rates of acceleration/deceleration
  • M203 set maximum feed rates
  • M204 set default rates of acceleration
  • M205 set minimum feed rates and planner speed
  • M206 set extruded noodle diameter, extruder maximum reverse feed rate, extruder deprime, slowdown limit, and direction of extruder feed
  • M207 set JKN Advance parameters K and K2
  • M208 set extruder steps per millimeter
  • M209 turn acceleration planner on or off; enable or disable override of gcode temperature settings
  • M215 set steps per millimeter for each axis
  • M216 set maximum speed changes for each axis
  • M200 reset (to pick up changes)

Unless otherwise stated, the content of this page is licensed under GNU Free Documentation License.

Gcode | Marlin Firmware