Skip to content

Code availability

A new remap needs an unallocated code. The tables below match the LinuxCNC interpreter shipped by Ctrl. Do not use a listed code for unrelated behavior.

Ctrl reserves these codes across all machine types:

Code Reserved meaning
M10 Unclamp workholding
M11 Clamp workholding
M14 P<device> Q<mode> Select workholding grip: Q0 external (OD), Q1 internal (ID)
M16 P<gear> Select the specified spindle gear
M20 Retract or release the tailstock quill
M21 Extend or engage the tailstock quill

A machine without the corresponding mechanism may leave the code unconfigured, but must not give it another meaning.

See Automatic workholding, Spindle gearbox, and Tailstock quill for the complete peripheral contracts.

Range Occupied codes
G0-G9.9 G0, G1, G2, G3, G4, G5, G5.1, G5.2, G5.3, G6, G6.1, G6.2, G6.3, G7, G8
G10-G19.9 G10, G17, G17.1, G18, G18.1, G19, G19.1
G20-G29.9 G20, G21, G28, G28.1
G30-G39.9 G30, G30.1, G33, G33.1, G38.2, G38.3, G38.4, G38.5
G40-G49.9 G40, G41, G41.1, G42, G42.1, G43, G43.1, G43.2, G49
G50-G59.9 G52, G53, G54, G55, G56, G57, G58, G59, G59.1, G59.2, G59.3
G60-G69.9 G61, G61.1, G64
G70-G79.9 G70, G71, G71.1, G71.2, G72, G72.1, G72.2, G73, G74, G76
G80-G89.9 G80, G81, G82, G83, G84, G85, G86, G87, G88, G89
G90-G99.9 G90, G90.1, G91, G91.1, G92, G92.1, G92.2, G92.3, G93, G94, G95, G96, G97, G98, G99

Blank code points are candidates for a G-code remap. LinuxCNC accepts new G-code remaps only in modal group 1.

Range Occupied codes
M0-M9 M0, M1, M2, M3, M4, M5, M6, M7, M8, M9
M10-M19 M10, M11, M14, M16, M19 (M10, M11, M14, and M16 are reserved by Ctrl)
M20-M29 M20, M21 (reserved by Ctrl)
M30-M39 M30
M40-M49 M48, M49
M50-M59 M50, M51, M52, M53
M60-M69 M60, M61, M62, M63, M64, M65, M66, M67, M68
M70-M79 M70, M71, M72, M73
M80-M89 None
M90-M99 M99
M100-M199 Conventional user-defined M-code range; do not remap it with REMAP.

M200-M999 are available for remapping. The examples use M400 and M401 from this range so they do not replace a built-in or Ctrl-reserved command.

Ctrl’s LinuxCNC build permits explicit redefinition of T, S, F, M0, M1, M6-M9, and M60-M68. Redefining one replaces its built-in interpreter behavior. Consult the LinuxCNC remap manual before doing so.