-
Notifications
You must be signed in to change notification settings - Fork 104
Additional M Codes
tomsrobotics edited this page Jun 3, 2019
·
5 revisions
Grbl32 added some extra M-Codes: M62, M63, M66, M67; these are based on the implementation at linuxcnc M Codes, with some minor differences. A custom M100 is added for acceleration scaling.
- M62/M63 : digital output. P-word is the bit of control. Examples:
- To turn ON output bit 0
M62 P0
- To turn OFF output bit 1
M63 P1
- The number of digital outputs will depend on the system implementation. A value of 255 for the P word will affect all available outputs. To turn OFF all available bits
M63 P255
- To turn ON output bit 0
- M66 : wait on digital input. P-word is the bit of control; L-word is the expected level (L3: wait to go HIGH, L4: wait to go LOW); Q-word is the timeout in seconds. Examples:
- Wait for input bit 0 to turn ON (go HIGH), timeout after 10 seconds
M66 P0 L3 Q10
- Wait for input bit 7 to turn OFF (go LOW), timeout after 12.5 seconds
M66 P7 L4 Q12.5
- Wait for input bit 0 to turn ON (go HIGH), timeout after 10 seconds
- M67 : analog output, additional PWM controls. E-word is the channel, Q-word is the analog value. When the PWM timer parameters are configured properly, the following are examples of controlling RC Servo motors:
- Set PWM Channel 0 (RC Servo 0) to a PPM pulse of 1000 usec (usually half left)
M67 E0 Q1000
- Set PWM Channel 7 (RC Servo 7) to a PPM pulse of 2500 usec (usually full right)
M67 E7 Q2500
- The number of PWM outputs will depend on the system implementation. A value of 255 for the E word will affect all available outputs. To turn set ALL available channels to 1500 usec (usually center)
M67 E255 Q1500
- Set PWM Channel 0 (RC Servo 0) to a PPM pulse of 1000 usec (usually half left)
- M100 : custom M-code, in code acceleration scaling to something less than 100%. P-word is the axis (X=0, Y=1, etc...), Q-word is the fractional value of the acceleration (1 = 100%).
- Change acceleration of X axis to 80% of $120
M100 P0 Q0.8
- Change acceleration of A axis to 50% of $123
M100 P3 Q0.5
- Change acceleration of ALL axis back to 100%
M100 P255 Q1
- Change acceleration of X axis to 80% of $120