MCodes
The below table shows the supported MCodes
optional stop. If M333 is enabled, the program will pause upon reaching this command. If M334 is set instead, no pause will occur
M2
end program, stop spindle and air
M3
Starts the spindle. The S parameter sets the speed in rotations per minute
M3 S5000
turns on spindle at 5000 rpm
M5
Stops the spindle
M5
M6
Auto tool change, T0 indicates wireless probe, T-1 indicates None
M6 T1
changes to tool 1 and sets TLO
M7
Starts the airflow
M7
M9
Stops the airflow
M9
M17
turn all enable pins on
Debug Only
M18
this allows individual motors to be turned off, no parameters falls through to turn all off
Debug Only
M20
list files at root of sd card. will not show subfolders
Debug Only
M21
code for octoprint for 3d printers, does nothing
Do not use
M23
select a file
M23 gcodes/test.cnc
M24
start playing current file
do not use
M25
pause currently playing file (use M600 for pauses)
do not use
M26
reset current file ready to start over
do not use
M27
report current progress (useful to sync the controller display to the current line)
M30
End of the program, no action on the Carvera. See M26
M30
M32
select a file and start playing. For macros see M98
M32 gcodes/test.cnc
M82
e_absolute_mode on
Debug Only
M83
e_absolute_mode off
Debug Only
M84
turn all enable pins off
Debug Only
M92
set steps per mm
M98 X12
sets the xsteps per mm to 12
open a sub program inside the current running gcode, often reffered to as a macro. return to the main program when done Parameter P is a number that references a file in the gcodes/macros folder with a name ####.cnc Optional L parameter loops the subprogram a set number of times
M98 P1001 L4
open subprogram by path, return to the main program when done. otherwise the same as above. the optional L command must come before the path
M98 L2 {gcodes/test.cnc}
M105
Read the current spindle temperature
M105
M112
emergency stop
Debug Only
M114
print current WCS for each axis to console
M115
report firmware version and capabilities
M115
FIRMWARE_NAME:Smoothieware, FIRMWARE_URL:http%3A//smoothieware.org, X-SOURCE_CODE_URL:https://github.com/Smoothieware/Smoothieware, FIRMWARE_VERSION:master-811c4f62, X-FIRMWARE_BUILD_DATE:Oct 30 2024 15:14:06, X-SYSTEM_CLOCK:100MHz, X-AXES:5, X-GRBL_MODE:1, X-CNC:1, X-MSD:1, X-WARNING:deprecated_MCU
M117
a special non compliant Gcode as it allows arbitrary text on the line following the command. Prints to available display panel
Use 118 instead
M119
report current probe information
X_max:0 Y_max:0 Z_max:0 pins- (XL)P0.24:0 (XL)P0.25:0 (YL)P1.1:0 (YL)P1.4:0 (ZL)P1.8:0 Probe: 0
M120
push state
Debug Only
M121
pop state
Debug Only
M143
3d printer specific code
Do Not Use
M203
set maximum feedrate in mm/sec
M203 X100
M203.1
set maxiumum actutor feedrates
M204
M204 Snnn - set default acceleration to nnn, Xnnn Ynnn Znnn sets axis specific acceleration
M205
M205 Xnnn - set junction deviation, Z - set Z junction deviation, Snnn - Set minimum planner speed
M206
set homing offset
M206 X15 Y15 Z15
sets homing offset to 15,15,15
M220
S<factor in percent>- set feed speed factor override percentage
M220 S50
M221
Turn on/off soft endstops
M221 S0
turns off soft endstops. M221 S1 turns them on
M223
S<factor in percent>- set spindle speed factor override percentage
M223 S80
M301
3d printer specific
Do not Use
M303-305
Used by the PID autotuner for temperature control of a 3d printer hotend. No function on the carvera
Do Not Use
M306
set homing offset based on current position
M321
Enter the laser mode, The machine will drop the current tool automatically and calibrate the spindle Collet (to set the laser offset to the working surface)
M321
M322
Exit the laser mode
M322
M323
Enter the laser test mode, the laser module will be supplied a very low power, usually used for re-focusing the laser
M323
M324
Exit the laser test mode
M324
M325
S<factor in percent>- set laser power factor override percentage
M325 S50
M331
Turn on the auto vacuum mode, if on, the vacuum will be turned on automatically when the spindle is running and turned off when the spindle is not running
M331
M332
Turn off the auto vacuum mode
M332
Turn on Line By Line Execution Mode. Pauses after each line. Does not pause on empty lines, or lines starting with ; or (
M370
Clears the auto bed levelling data and disabled the compensation until G32 is run again
M370
M374
save the autoleveling grid to sd card.
need to test
M374.1
delete the autoleveling grid
need to test
M375
load the grid from the sd card
need to test
M375.1
Display the current bed levelling grid data in the MDI window
M375.1
M400
wait for all moves are done up until this point
calibrate probe tip using round bore of known size
M460 X25 L3
start centered inside bore. Will calibrate based off a 25mm bore, averaging the value over 3 tests. This will save the value to variable #150. Use config-set sd zprobe.probe_tip_diameter # to store this value for resets. All parameters from M461 except T,S are implemented
calibrate probe tip using boss of known size
M460.2 X15 L3
start centered over boss . Requires X or Y but not both. The value for X or Y is the measured dimention of the boss. L is the number of times to probe and average over. All paremeters from M462 except T,S are implemented
calibrate probe tip using anchor 2
M460.3
will move to the correct position by clearance Z, move xy, probe down in z. Position is based on config position for anchor 2 and the saved anchor width. Measure and set the anchor width first.
probe bore
M461 X25 Y30 D2.5 H10 C2 Q15 L2 R1.8 S1 F100 K200
Start at roughly the center of the bore, the macro starts with a z probe, moving (H)10mm down. If the tool hits the surface it will retract by (C)2. If not, it will continue from the new low position. If H is not given or 0, the macro will probe from the starting height. Then probe (X)25mm in the X direction rotated by (Q)15 degrees until the tool hits a surface. Retract off the surface by (R)1.8mm back toward center, then reprobe at a much slower rate. Move back to center and repeat for the -x rotated direction. Repeat the X steps for the Y direction, probing (Y) 30. Repeat the X and Y probes (L)2 times. All normal probe moves happen at (F)100 mm/sec, moving between probe starts happens at the rapid rate (K)200. When complete the program will have saved the distance along the X axis as #151, the distance along the Y axis as #152, the center point in MCS as #154,#155. Since S is set to 1 the program will set the current WCS (usually G54 unless overridden) as the center of the bore. If S is not set the probe macro will not effect the WCS. (D) is used to calculate the distance between points and represtents the tool tip diameter. All paremeters are optional but you must have 1 of X or Y, if you supply only 1 of them it will only probe in that direction.
probe boss
M461 X25 Y25 E12
All parameters from M461 work. Starting from the rough center of the rectangular block/boss the probe will move (X) 25 mm in the positive X direction, then probe down by the -(C+E) to get to the side of the block. It will then double tap probe toward the center of the block to find point 1. It will return to the clearance position, then the center position, then repeat the x probe for the negative direction and both y directions. The output variables are the same as M461. If S1 is set the center of the boss will be the new xy origin. If S2 is set and a probing height (H) was given, the z origin is set to the probed surface
probe inside corner
M462 X-15 Y-15
Implements D, H, C, Q, F, K, L, R, S from M461. Probes a bottom left inside corner (the direction of X and Y determine the direction the probe moves, in this case left and toward the front of the machine). Saves the center position to #151 and #152
probe outside corner
M463 X15Y15
Implements D, H, C, Q, F, K, L, R, S from M461. Implements E from M462 and follows a similar progress for 2 points instead of 4. Probes a bottom left outside corner (the direction of X and Y determine the direction the probe moves, in this case left and toward the front of the machine). Saves the center position to #151 and #152. S works the same as in M462
probe axis and angle
M464 X10 E10 V10
Implements H,C,X,Y,Q,F,K,L,R from M461. Will only take 1 axis value (X or Y). From the starting position: double tap probe with distance (E)10 perpindicular to the axis given until a surface is hit. Sign of E determines probing direction. Return to the starting position. Move along the given axis by (X)10 and repeat the probe. Return to the starting position. Since V is set the probe will move along the same angle as the probe surface by (V)10. Stores the angle as degrees in #153
straight probe with double tap
M466 X{dist} Y{dist} Z{dist} D{tip diameter} Q{angle} L{repeats} R{retract} S{save as xy, if only 1 axis is given with no q, then will only save that axis as zero} F{feed rate} I{invert for NC}
M469 / M469.0
Future: home machine with true 3 axis probe on user defined pin
not implemented
M469.0 I{invert}
M469.3
Future: calibrate atc tool position with true 3 axis probe
not implemented
calibrate 4tha axis headstock with true 3 axis probe
M469.4
M469.4 I{invert} Y{headstock width} H{how far down to probe}
calibrate 4th axis height offset with probe
M469.5
M469.5 R{Pin diameter} X{Distance from 1st probe position to probe} H{Max distance down to probe}
M469.6
report and set machine offsets (machine only code)
Debug Only
X - original X pos Y- original y pos, Z - orig z pos, P-probe set type. 1 is for anchor 1,2 is anchor 2, 3 is atc tool pos, etc
M470
set the wireless probe address
M470 S2020
M471
set the wireless probe into pairing mode
M471
M472
turn on the wireless probe laser
M472
M481-489
wifi specific gcodes that are better done via the console commands
Do Not Use
M490
Execute the ATC homing process, homing will be executed automatically when issuing M490.1 or M490.2 if needed
M490
M490.1
Tightens the spindle collect to secure a new tool in the spindle
M490.1
M490.2
Loosens the spindle collet and drops the current milling bit
M490.2
M491
Execute a calibration, and the TLO (tool length offset) for the current tool will be reset
M491
performs a tool break check by calibrating the current tool and comparing its length to a previously stored tool length offset (TLO).
M491.1 H0.05
If a difference greater than 0.05 than halt machine
M492
internal command to determine if toolrack is empty.
Debug Only
save tool offset when it has triggered the TLO probe. Use M493.3 to set the TLO to a particular value
Debug Only
save tool length offset to value. use Z for a completely new value.
M493.3 Z-15
sets the TLO to -15
Sets TLO from current WCS position with an offset H.
M493.3 H10
start with the tool 10mm above WCS Z, using the gague pin or paper trick. This will calculate the proper TLO to match the current WCS
M493.5
Future: ATC pause
M494 / M494.1
turn on probe laser
M494.1
M494.2
turn off probe laser
M494.2
M495
Do Margin, ZProbe, Auto Leveling based on parameters, change probe tool if needed. X and Y are Margin start. C and D are margin extents. O and F are Z Probe Offsets. A, B are the extents of the autolevel, I and J are the number of points across each axis to probe, H is autolevel probe height P1 will goto origin
M495.3
does a 3 axis z probe along the -z, -x, and -y. See G38 for other probing functions. D sets probe tip diameter, H is the thickness of the stock 3 axis probe metal piece
M495.3 D3.175 H9
M496.2
goto work origin. X and Y parameters set position in relation to anchor 1
M496.2 X30Y0
M496.3
goto anchor 1
M496.4
goto anchor 2 position
M496.5
goto position. X and Y parameters set position in relation to anchor 1
M496.5 X30Y0
M497
wait for queue to empty. Usually an internal command
Debug Only
M498 / M498.1
report eeprom data. Will print current tool number, TLO, toolmz, refmz, and WCS offsets to the console
M498.2
erase EEProm data. Do not run
Do not use
M499/M499.1
prints current tool information to the console
M499.2
prints all atc tool location data to the console
M500
save changes to config file to sd card
M501
// load config override
Debug Only
not implemented
M502
M502 deletes config-override so everything defaults to what is in config
Debug Only
M503
print config file values to console
M504
save to specific config override file
M504 "/sd/config-override"
M561
Clears the auto bed levelling data and disabled the compensation until G32 is run again. Same as M370
M565
sets zprobe offsets. Investigate at a later date
M600
pause the current file (use this to add pauses)\
M601
resume the current file - usually run from MDI console
M665
M665 set optional arm solution variables based on arm solution.
unsure of function
M670
set probe default info until next reset. S - slow feedrate, K - fast feedrate, R - return feedrate, Z- max z depth to probe, H - distance to probe, I - probe inversion status, D - dwell before probing
M801
Turn on the vacuum. The S parameter sets the power of the vacuum
M801 S100
M802
Turn off the vacuum
M802
M811
Turn on the spindle cooling fan. The S parameter sets the power of the fan
M811 S100
M812
Turn off the spindle cooling fan
M812
M821
Turn on the light
M821
M822
Turn off the light
M822
M831
Turn on the tool detector sensor laser
M831
M832
Turn off the tool detector sensor laser
M832
M841
Turn on the wireless probe charging power
M841
M842
Turn off the wireless probe charging power
M842
M851
Turn on the extended port power. The S parameter sets the PWM output of the port
M851
M852
Turn off the extended port power
M852
M881
Set 2.4G Channel to: the S parameter and start transmitting
M881 SwifiNetworkName
M882
turn off wifi network
M882
M885
turn off hard endstops (reverts to on on power cycle, ignored when homing)
M886
turn on hard endstops
M887
turn off home check
M888
turn on home check
]
report spindle speed
M957
current spindle speed and status
State: on, Current RPM: 15086 Target RPM: 15000 PWM value: 0.699
M958
set spindle PID parameters, parameters P, I, D
M1000
M1000 is a special command that will pass thru the raw lowercased command to the simpleshell (for hosts that do not allow such things)
Last updated