New to LinuxCNC, need info on HAL and M Codes

More
07 May 2018 21:52 #110347 by SleipnirPilot
Folks,

Im very new to LinuxCNC and programming in general - my previous machine ran on GRBL and I did very little gcode editing with it.

I have a laser added to my CNC router and am having difficulty setting it up how I would like.

Currently the laser driver receives an On/Off signal via M62/M63. This is creating a problem as I am unable to vary the input power to the driver and cannot vary my laser intensity. I have done a bunch of research on this forum and have decided to use a M67 signal with a Q value to control my laser power. My question is this: How do I change the setup in LinuxCNC to send a M67 signal to the pin on the paraport that is currently receiving the M62/M63 signals?

In other words, parport1.pin14 is the pin connected to my laser driver input, but is getting M62/M63. How do I change it to M67?

Thanks for any instruction and advice!

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

More
07 May 2018 22:51 #110352 by rodw
The bigger question is how do you physically vary laser power?

Currently you are using a digital on/off signal with 2 states so that probably can't output a PWM signal to vary the laser power (if thats how it is controlled).

So to help we need to know what inputs are on the laser itself to control both on/off and laser intensity.

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

More
07 May 2018 23:07 #110354 by SleipnirPilot
The driver uses a PWM signal, on my old GRBL machine it was via a M3 Sxxx command in the gcode file.

Speaking w the driver mfg, the driver itself doesnt need a specific M code, just looks at whatever the 0-10V input is (normally via a PWM) and proportionalizes the output on a 0-100% power scale

Reading threads on lasers on this forum, I read that using a M3 code slows down the feed rate due to the order LinuxCNC processes gcode, but exprimentation shows using a M67 Qx Exx code slows down the feed rate the least which is a huge necessity for lasering.

Eventually Im hoping to learn how to get a modified PWM signal coded so it will vary the signal proportional to feed rate so, IE as the machine slows down, it lowers laser power to ensure even burn regardless of feed rate

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

More
07 May 2018 23:34 - 07 May 2018 23:35 #110356 by rodw
I'm not across laser or parallel ports. You probably are stuck with using the PWM output on the spindle control on a parallel port (M3 SXX). You could write a custom component to control it if it was necessary.

Have a look at the plasma section as there are a few components shared there which would be useful.
THis one shows how to use M67/M68 ranges to control different functions based on the numeric value passed
forum.linuxcnc.org/plasma-laser/32700-co...hc-from-within-gcode
you could enable the laser with motion.digital-in-nn (M64/M65) and2'd with motion.spindle-on. What that means is that you would have to add a M64 P0 and an M3 to the code so that if you hit estop, the laser is disabled. (estop does not turn off motion.digital-in-nn pins.

Also, there is a cornerlock component in the plasma section that monitors the velocity and turns off torch height control if the velocity falls below a certain percentage of the commanded velocity. You could adapt this to reduce laser power
Last edit: 07 May 2018 23:35 by rodw.

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

More
08 May 2018 01:07 #110360 by SleipnirPilot
I am using a lot of the information garnered from this thread to attempt to copy what they did.

From what I gather, a M67 analog output signal will work for my application.

My question is, how do I assign a specific M code to a specific pin on my parallel port?

When the folks at Probotix build my machine, they assigned M62 to pin 14 on the parallel port, not understanding that an analog signal would control my lasers power. I need to reassign M67 to pin 14,

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

More
08 May 2018 13:23 #110379 by Todd Zuercher
A parallel port pin is a digital io point (on or off) and can't easily communicate a "number". There are 3 usual ways a "number" value can be transmitted, a digital serial signal, a digital PWM signal, or an analog signal. The only one that a parallel port can do by its self (without additional hardware) is a PWM, and it is marginal even for that. Which kind of signal does your Laser need?

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

More
08 May 2018 13:33 #110380 by SleipnirPilot
The laser takes a 0-10V signal (usually PWM but any variable input signal) and coverts it to a percentage of 100% power.

forum.linuxcnc.org/10-advanced-configura...r-laser?limitstart=0

this thread is what I am attempting to replicate - It is 100% possible to get a variable power output via a parallel port from what I am reading, using a M67 Ex Qxxx line in gcode.

I hope I am not being confusing here - Im looking for information on how to remap a parallel port to receive a specific M code (M67/M68), not looking for info on how to drive my laser - I already have that figured out.

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

More
08 May 2018 13:47 - 08 May 2018 13:50 #110381 by Todd Zuercher
You will need to load a PWMgen component to create a PWM signal and connect the output of that to your pin14.

Your float number from your M67 will use the motion.analog-out-00 (or what ever number) hal pin to connect to the float input pin for the pwmgen.

You will also probably need something like a Mesa Spinx1 to convert that pwm into a 0-10v signal you can connect to your laser's analog input.
Last edit: 08 May 2018 13:50 by Todd Zuercher.
The following user(s) said Thank You: SleipnirPilot

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

More
08 May 2018 20:48 #110399 by tommylight

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

More
09 May 2018 02:36 #110406 by SleipnirPilot
Thanks Todd, thats what I was looking for. I wasnt looking for ideas on how to make my laser work - all I needed to know was how to send a specific M-Code to a specific pin.

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

Time to create page: 0.164 seconds
Powered by Kunena Forum