Toggling M67 for laser manually from GUI

More
10 May 2022 03:16 #242457 by theslawek
I have PWM laser setup on a 7I76E STEPDIR4 port. I use M67 in my GCode to control the laser. I can only enable the laser when I run the program. I'd like to be able to turn on the laser (<1%) with GUI commands (gmoccapy) while doing job setup. What do I need to do? I've browsed the forum but didn't find this exact question and I only started using LinuxCNC a week ago.

Here is my HAL related to Laser.
setp hm2_7i76e.0.pwmgen.00.output-type     1
setp hm2_7i76e.0.pwmgen.pwm_frequency     20000
setp hm2_7i76e.0.pwmgen.00.scale         100

net laser_pwm motion.analog-out-00 => hm2_7i76e.0.pwmgen.00.value # M67 E0 Q#
net laser_pwm_enable halui.program.is-running => hm2_7i76e.0.pwmgen.00.enable #M62
net laser_pwm_enable halui.program.is-running => hm2_7i76e.0.7i76.0.0.output-01 #air support solenoid

I tried adding something like this (to hijack the spindle-enable button) to enable the laser but I get an error on startup.
#net spindle-enable => hm2_7i76e.0.pwmgen.00.enable
./CNC_Laser.hal:54: Pin 'hm2_7i76e.0.pwmgen.00.enable' was already linked to signal 'laser_pwm_enable'

Please Log in or Create an account to join the conversation.

More
10 May 2022 05:12 #242461 by rodw
I would use one of the Gmocappy macro buttons and issue the M67 gcode. Nice and easy!

Please Log in or Create an account to join the conversation.

More
10 May 2022 07:01 #242465 by theslawek
Aha, great idea. Thanks for pointing that out. Not working though. None of my Gcode actually uses M62 to enable the PWM even though I thought it would be needed when I first did the research. I looked at HAL show while running the macro and laser_pwm_enable does toggle, but laser_pwm stays at 0. My air assist solenoid does trigger for the 5 second dwell period, but no laser.

Once we figure out the laser turning on part, I would like for the laser to stay on without needing the dwell period. Is that possible?

Entries in the INI
[RS274NGC]
PARAMETER_FILE = linuxcnc.var
SUBROUTINE_PATH = macros

[MACROS]
MACRO = laser_trace_on

I created laser_trace_on.ngc in the macros folder. (I know the path is right, because gmoccapy would complain about errors in the file before I fixed them.)
; Test file go to turn on laser for tracing

O<laser_trace_on> sub

M67 E0 Q1

G4 P5

O<laser_trace_on> endsub
M2

Please Log in or Create an account to join the conversation.

Time to create page: 0.064 seconds
Powered by Kunena Forum