Back to the Gcode Dictionary
M452: Select Laser DeviceMode
- Pnnn Logical pin number used to control the laser (not supported in RRF3, see notes)
- In Invert (I1) or don't invert (I0, default) the output polarity (not supported in RRF3, see notes)
- Rnnn The value of the S parameter in M3 commands that corresponds to full laser power, default 255
- Sn 1= laser power is sticky across G1 commands, 0 (default) = laser is off when executing G1 commands that have no S parameter
- Fnnn The PWM frequency used to drive the laser - default is 500Hz
- M452 P2 R255 F200 ; switch to laser mode using the heater 2 (E1 heater) output pins to control the laser
Switches to laser mode. This mode enables handling of a laser pin and makes sure that the laser is only activated during G1 moves if laser was enabled or E is increasing. G0 moves should never enable the laser. M3/M5 can be used to enable/disable the laser for moves. Logical pin numbers for the P parameter are as defined for the M42 and M208 commands. If a heater or fan output is used to control the laser, you must disable the corresponding heater (see M307) or fan (see M106) first.
Very important! If you use M452 to put your machine into Laser mode and are running Firmware 2.02 or above, you must replace all S parameters in G0/G1 commands in homing files etc. by H parameters. This is because S is now used to control laser power.
Notes - RepRapFirmware 3
In RRF3, the P and I parameters are removed. Use the C parameter to select the laser control pin instead.
Example - old code (RRF2.x):
M452 P3 I1 F100 ; laser uses heater3 pin, PWM frequency 100Hz
New code (RRF3):
M452 C"exp.heater3" F100 ; laser uses heater3 pin, PWM frequency 100Hz