MCodeReference

From RepRap
Revision as of 14:21, 30 May 2008 by BrendanErwin (talk) (version migrated from twiki)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

RepRap Custom M Code Reference

This page lists the custom M Codes defined for RepRap and details of their use and syntax in the various producers and consumers of G Code.

M Code Description Notes Arduino_GCode_Interpreter EmcRepStrap Output by Skeinforge?
M101 Extruder on, forward Turns the extruder motor on in the forward direction at the speed specified with M108. It will also cause a delay if the extruder is not at the target temperature as it heats up. It will print the ASCII string "Temp: ###" to the terminal every second as feedback on the temperature. Measured in Celsius. TODO: Poll the HAL prior to sending the command to the Arduino. If the HAL reports the temperature is lower than the target temperature then block and wait. Sends "M101" to the Arduino. Yes
M102 Extruder on, reverse Turns the extruder motor on in the reverse direction at the speed specified with M108. TBD No
M103 Extruder off Turns the extruder off. Sends "M103" to the Arduino. Yes
M104 Extruder set temperature Sets the target temperature for the extruder in Celsius. Accepts S parameter. Example: M104 S50 sets the extruder target to 50 Celsius. Accepts P parameter. Example: M104 P50 sets the extruder target to 50 Celsius. Sends "M104 Snnn" to the Arduino. Yes
M105 Extruder get temperature Gets the temperature of the extruder. Printed to serial port as ASCII string: "Temp: ###" No-Op. Included to prevent things from breaking, but does nothing. No
M106 Turn fan on Turns the cooling fan on. Sends "M106" to the Arduino. No
M107 Turn fan off Turns the cooling fan off. Sends "M107" to the Arduino. No
M108 Extruder Speed Sets the Extruder Feed Motor Speed. Accepts the 'S' parameter as a number between 0 and 255. This is the speed to use for extruder motor PWM (when extruder is turned on.) Accepts the 'R' parameter as a number that is interpreted as the RPM to run the extruder motor at. Only supported with encoder based firmwares. Currently only accepts P as the motor PWM value. Sends "M108 Snnn" to the Arduino. Yes
M120 Extruder P Gain Set extruder P gain for PID control of the extruder rotation speed. Accepts the 'S' parameter as a float for the proportional gain value. TODO: Accepts the 'P' parameter as a float. Sends "M120 Snnn.nnn" to the Arduino. Yes (via start.txt)
M121 Extruder I Gain Set extruder I gain for PID control of the extruder rotation speed. Accepts the 'S' parameter as a float specifying the integral gain value. TODO: Accepts the 'P' parameter as a float. Sends "M121 Snnn.nnn" to the Arduino. Yes (via start.txt)
M122 Extruder D Gain Set extruder D gain for PID control of the extruder rotation speed. Accepts the 'S' parameter as a float for the differential gain value. TODO: Accepts the 'P' parameter as a float. Sends "M122 Snnn.nnn" to the Arduino. Yes (via start.txt)

M123 - Set extruder I max for the windup guard

Accepts the 'S' parameter as a float for the iMax variable

M122 - Set extruder I min for the windup guard

Accepts the 'S' parameter as a float for the iMin variable

-- Main.BrendanErwin - 30 May 2008