Secondary PWM Output for LASER
- ericg
- Offline
- Premium Member
-
Less
More
- Posts: 138
- Thank you received: 10
22 Sep 2021 12:52 #221339
by ericg
Replied by ericg on topic Secondary PWM Output for LASER
Thanks for the reply, but I am no programmer and I looked at the code but haven't the slightest idea of how to do it or where to start.
I can follow some post processor code but this is beyond me
Thanks anyway
I can follow some post processor code but this is beyond me
Thanks anyway
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 20789
- Thank you received: 7079
22 Sep 2021 14:34 #221346
by tommylight
Replied by tommylight on topic Secondary PWM Output for LASER
OK, if it is easier for you open the generated gcode file and use the "search and replace" feature of the text editor to replace the Z with M67, also notice that there might be - after the Z, so that also has to be removed.
Please Log in or Create an account to join the conversation.
- abs32
- Offline
- New Member
-
Less
More
- Posts: 9
- Thank you received: 0
14 Oct 2025 16:11 - 14 Oct 2025 16:45 #336428
by abs32
Replied by abs32 on topic Secondary PWM Output for LASER
Good afternoon colleagues.
I ask for help connecting the laser to the machine.
My machine works properly without LPT. Scheme XXYYZ. This is five motorcycles. And a spindle. The spindle to the 14-pin LPT port is such a feature of the controller.
I read topics -
forum.linuxcnc.org/10-advanced-configura...pwm-output-for-laser
forum.linuxcnc.org/plasma-laser/32691-settings-from-g-code-file
forum.linuxcnc.org/10-advanced-configura...er-control-using-pwm
From what I read, I understood the following -
1. from the g-code file, control the status and power of the laser using the M67-M68 commands
2. the main thing is that the correct configuration must be made in the machine settings file
My PWM laser is up to 20kgz.
I'm trying to add the following lines -
loadrt pwmgen output_type=1.0 #1 this is for Spindel, 0 for Laser
...
#net spindle-pwm => parport.0.pin-14-out
#setp parport.0.pin-14-out-invert 1
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
#setp pwmgen.0.pwm-freq 100.0
#setp pwmgen.0.scale 15000.0
#setp pwmgen.0.offset 0.133333333333
#setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed => spindle.0.at-speed
#лазерный блок
#addf pwmgen.make-pulses base-thread
# addf pwmgen.update servo-thread
setp parport.0.pin-14-out-invert 0
setp pwmgen.1.enable TRUE
#setp pwmgen.1.pwm-freq 20000
net analogout motion.analog-out-00 => pwmgen.1.value
net laserpwm pwmgen.1.pwm => parport.0.pin-14-out
doesn't work. The laser is not turned on by the M68 E0 Q 1 commands
Please tell me what I'm doing wrong? And is it possible to use the same pin 14 (I physically turn off the spindle or laser) for control?
I ask for help connecting the laser to the machine.
My machine works properly without LPT. Scheme XXYYZ. This is five motorcycles. And a spindle. The spindle to the 14-pin LPT port is such a feature of the controller.
I read topics -
forum.linuxcnc.org/10-advanced-configura...pwm-output-for-laser
forum.linuxcnc.org/plasma-laser/32691-settings-from-g-code-file
forum.linuxcnc.org/10-advanced-configura...er-control-using-pwm
From what I read, I understood the following -
1. from the g-code file, control the status and power of the laser using the M67-M68 commands
2. the main thing is that the correct configuration must be made in the machine settings file
My PWM laser is up to 20kgz.
I'm trying to add the following lines -
loadrt pwmgen output_type=1.0 #1 this is for Spindel, 0 for Laser
...
#net spindle-pwm => parport.0.pin-14-out
#setp parport.0.pin-14-out-invert 1
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
net spindle-pwm <= pwmgen.0.pwm
#setp pwmgen.0.pwm-freq 100.0
#setp pwmgen.0.scale 15000.0
#setp pwmgen.0.offset 0.133333333333
#setp pwmgen.0.dither-pwm true
net spindle-cmd-rpm <= spindle.0.speed-out
net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
net spindle-cmd-rps <= spindle.0.speed-out-rps
net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
net spindle-at-speed => spindle.0.at-speed
#лазерный блок
#addf pwmgen.make-pulses base-thread
# addf pwmgen.update servo-thread
setp parport.0.pin-14-out-invert 0
setp pwmgen.1.enable TRUE
#setp pwmgen.1.pwm-freq 20000
net analogout motion.analog-out-00 => pwmgen.1.value
net laserpwm pwmgen.1.pwm => parport.0.pin-14-out
doesn't work. The laser is not turned on by the M68 E0 Q 1 commands
Please tell me what I'm doing wrong? And is it possible to use the same pin 14 (I physically turn off the spindle or laser) for control?
Last edit: 14 Oct 2025 16:45 by abs32.
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 20789
- Thank you received: 7079
14 Oct 2025 16:20 #336430
by tommylight
Replied by tommylight on topic Secondary PWM Output for LASER
Have a look at this, there is also the complete config attached there, it is the same thing as laser as it uses PWM to control the grinding bit pressure, and it also should have provisions for turning off the laser when canceling or pausing or stopping a job, that is normally not done with normal configs.
forum.linuxcnc.org/show-your-stuff/46752...er-scratcher?start=0
forum.linuxcnc.org/show-your-stuff/46752...er-scratcher?start=0
Please Log in or Create an account to join the conversation.
- abs32
- Offline
- New Member
-
Less
More
- Posts: 9
- Thank you received: 0
14 Oct 2025 16:30 #336431
by abs32
Replied by abs32 on topic Secondary PWM Output for LASER
I’m on that topic (at the same time I express my admiration for the design shown there) but I didn’t see anything on my question.
Clearly I'm doing something wrong in the hal file.
But what exactly?
Clearly I'm doing something wrong in the hal file.
But what exactly?
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 20789
- Thank you received: 7079
14 Oct 2025 16:47 #336433
by tommylight
Replied by tommylight on topic Secondary PWM Output for LASER
Open the hal file attached at that link, somewhere lower in the thread, it is named Graveri kuq as zip file, compare your hal to mine till you get it working, then add the safety stuff with some signal names in Albanian.
Please Log in or Create an account to join the conversation.
- abs32
- Offline
- New Member
-
Less
More
- Posts: 9
- Thank you received: 0
14 Oct 2025 17:15 - 14 Oct 2025 17:56 #336435
by abs32
Replied by abs32 on topic Secondary PWM Output for LASER
Download the archive file. I see lines there in the pwm part -
loadrt pwmgen output_type=1
addf pwmgen.make-pulses base-thread
addf pwmgen.update servo-thread
net pwmdhez motion.teleop-mode => not.0.in
setp pwmgen.0.pwm-freq 1000.0
setp pwmgen.0.scale 6.0
setp pwmgen.0.offset 0.1
specific, not for me -
setp pwmgen.0.dither-pwm true
net jasht logic.0.and pwmgen.0.enable
net dout-00 <= pwmgen.0.pwm
net dout-00 => parport.0.pin-02-out
Doesn't work. I checked the electrician. With command M68 E0 Q 0.0 voltage per pin 14 = -0.4v, M68 E0 Q 1 voltage 4.7. I won't tell you the frequency.
loadrt pwmgen output_type=1
addf pwmgen.make-pulses base-thread
addf pwmgen.update servo-thread
net pwmdhez motion.teleop-mode => not.0.in
setp pwmgen.0.pwm-freq 1000.0
setp pwmgen.0.scale 6.0
setp pwmgen.0.offset 0.1
specific, not for me -
setp pwmgen.0.dither-pwm true
net jasht logic.0.and pwmgen.0.enable
net dout-00 <= pwmgen.0.pwm
net dout-00 => parport.0.pin-02-out
Doesn't work. I checked the electrician. With command M68 E0 Q 0.0 voltage per pin 14 = -0.4v, M68 E0 Q 1 voltage 4.7. I won't tell you the frequency.
Last edit: 14 Oct 2025 17:56 by abs32.
Please Log in or Create an account to join the conversation.
- tommylight
-
- Away
- Moderator
-
Less
More
- Posts: 20789
- Thank you received: 7079
14 Oct 2025 18:13 #336439
by tommylight
Replied by tommylight on topic Secondary PWM Output for LASER
Pretty sure mine does not use M68, but M67.
The included dmap2gcode can open an image and output gcode you can test with, it creates a depth map of the image so it also varies the laser PWM as needed.
You can use my config as is, but:
-you have to edit the hal file parallel port pins for your hardware
-maybe also edit the ini file velocities and accelerations for your machine as mine are set very high on acceleration and slow for velocity
-it also has a PyVCP panel that shows the PWM/laser power
-my config is alos limited to roughly 80% of max PWM to prevent pressure servo motor from triggering protection, you do not need that so you can push 100%.
The included dmap2gcode can open an image and output gcode you can test with, it creates a depth map of the image so it also varies the laser PWM as needed.
You can use my config as is, but:
-you have to edit the hal file parallel port pins for your hardware
-maybe also edit the ini file velocities and accelerations for your machine as mine are set very high on acceleration and slow for velocity
-it also has a PyVCP panel that shows the PWM/laser power
-my config is alos limited to roughly 80% of max PWM to prevent pressure servo motor from triggering protection, you do not need that so you can push 100%.
Please Log in or Create an account to join the conversation.
- abs32
- Offline
- New Member
-
Less
More
- Posts: 9
- Thank you received: 0
14 Oct 2025 18:16 - 14 Oct 2025 18:21 #336440
by abs32
Replied by abs32 on topic Secondary PWM Output for LASER
let’s be more specific and in this topic announce the parameters necessary for working in hal?
my current version is this -
#раздел шпинделя
loadrt pwmgen output_type=1,0
addf pwmgen.make-pulses base-thread
addf pwmgen.update servo-thread
#net spindle-pwm => parport.0.pin-14-out #при работе с лазером отключить
#setp parport.0.pin-14-out-invert 1 #при работе с лазером отключить
net spindle-pwm <= pwmgen.0.pwm
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 15000.0
setp pwmgen.0.offset 0.133333333333
setp pwmgen.0.dither-pwm true
#net spindle-cmd-rpm <= spindle.0.speed-out
#net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
#net spindle-cmd-rps <= spindle.0.speed-out-rps
#net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
#net spindle-at-speed => spindle.0.at-speed
#лазерный блок
net laserpwm => parport.0.pin-14-out
net laserpwm <= pwmgen.1.pwm
net analogout motion.analog-out-00 => pwmgen.1.value
setp pwmgen.1.enable TRUE
setp pwmgen.1.pwm-freq 1000
setp pwmgen.1.scale 6.0
setp pwmgen.1.offset 0.1
setp pwmgen.1.dither-pwm true
my current version is this -
#раздел шпинделя
loadrt pwmgen output_type=1,0
addf pwmgen.make-pulses base-thread
addf pwmgen.update servo-thread
#net spindle-pwm => parport.0.pin-14-out #при работе с лазером отключить
#setp parport.0.pin-14-out-invert 1 #при работе с лазером отключить
net spindle-pwm <= pwmgen.0.pwm
net spindle-cmd-rpm => pwmgen.0.value
net spindle-on <= spindle.0.on => pwmgen.0.enable
setp pwmgen.0.pwm-freq 100.0
setp pwmgen.0.scale 15000.0
setp pwmgen.0.offset 0.133333333333
setp pwmgen.0.dither-pwm true
#net spindle-cmd-rpm <= spindle.0.speed-out
#net spindle-cmd-rpm-abs <= spindle.0.speed-out-abs
#net spindle-cmd-rps <= spindle.0.speed-out-rps
#net spindle-cmd-rps-abs <= spindle.0.speed-out-rps-abs
#net spindle-at-speed => spindle.0.at-speed
#лазерный блок
net laserpwm => parport.0.pin-14-out
net laserpwm <= pwmgen.1.pwm
net analogout motion.analog-out-00 => pwmgen.1.value
setp pwmgen.1.enable TRUE
setp pwmgen.1.pwm-freq 1000
setp pwmgen.1.scale 6.0
setp pwmgen.1.offset 0.1
setp pwmgen.1.dither-pwm true
Last edit: 14 Oct 2025 18:21 by abs32.
Please Log in or Create an account to join the conversation.
Time to create page: 0.119 seconds