MCodeReference

From RepRapWiki
Jump to: navigation, search

RepRap Custom M Code Reference

This is an older list of "M" Functions.

A more up to date list is here:- http://reprap.org/wiki/Mendel_User_Manual:_RepRapGCodes

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. See also Arduino_GCode_Interpreter

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. Deprecated 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. Deprecated TBD No
M103 Extruder off Turns the extruder off. Deprecated 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: "T: ###" 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. Yes
M107 Turn fan off Turns the cooling fan off. Sends "M107" to the Arduino. Yes
M108 Extruder Speed Sets the Extruder Feed Motor Speed. Deprecated, See M113. 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
M109 Set Extruder Temperature, Wait Sets the target temperature for the extruder in Celsius, then waits for it to get there before responding Accepts S parameter. Example: M109 S50 sets the extruder target to 50 Celsius.  ?  ?
M110 Starting New Print Resets the line count check.  ?
M111 Send debug? Sends back the S Parameter, maybe?  ?
M112 Stop Cancels print and clears the buffer.  ?
M113 Extruder PWM Set the PWM for the currently-selected extruder. On its own this command sets RepRap to use the on-board potentiometer on the extruder controller board to set the PWM for the currently-selected extruder's stepper power. With an S field for values of 0 to 1, for example M113 S0.7 causes the PWM to be set to the S value. M113 S0 turns the extruder off, until an M113 command other than M113 S0 is sent. Yes (via Speed tool)
M114 Current Position Returns current coordinates.  ?
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 Extruder iMax parameter Set extruder I max for the windup guard Accepts the 'S' parameter as a float for the iMax variable
M124 Extruder iMin parameter Set extruder I min for the windup guard Accepts the 'S' parameter as a float for the iMin variable
M126 Open Valve Opens Valve Currently uses the 'A' output.  ?
M127 Close Valve Closes Valve Currently uses the 'A' output.  ?

-- Main.BrendanErwin - 30 May 2008