Hello Guest it is December 09, 2019, 12:51:28 AM

Author Topic: M-code to turn laser on/off - Can my macro execute any faster?  (Read 3840 times)

0 Members and 1 Guest are viewing this topic.

M-code to turn laser on/off - Can my macro execute any faster?
« on: November 26, 2016, 09:29:46 PM »
Hello, I've been using my CNC to laser engrave things with a DIY 2W setup.

Initially, my z-signal got redirected to a relay, that would turn the laser on or off.

Now, I'm trying to use the output signals on my G540's. I have M420 set to turn the laser on, and M421 to turn it off. It works just fine... HOWEVER - the macro takes a second to execute and leaves a small burn mark where the laser starts and stops.

Is there a way to make the macros execute faster? The only line of code in the file is "ActivateSignal(OUTPUT1)".

Maybe M11/M10 codes will work better? I have no experience with those yet

Alternatively, I might be completely overlooking a simple way to control lasers with Mach3. Any help would be appreciated!!!

Thanks

EDIT: sorry for prematurely posting... I think the M11/M10 will work here after some testing
« Last Edit: November 26, 2016, 09:37:27 PM by frarebear »

Offline Tweakie.CNC

*
  • *
  •  8,016 8,016
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #1 on: November 27, 2016, 02:33:06 AM »
M11 / M10 is the way to go.

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #2 on: November 27, 2016, 02:36:49 AM »
M11 / M10 is the way to go.

Tweakie.

Thanks!

I got it working on my machine. A buddy is trying it too, and we need to add a delay. There's a spot to enter the millisecond delay for both M11, and M10. On mine, I changed it to 25 for testing purposes, and it ran just fine. For his, he set it to 25 and it started cutting things in the wrong place, as well as making odd noises.

I have no idea what that means. I saw another post about changing the IJ settings in general config, but he said that didn't do anything.

When he changed the values back to 0, everything returned to normal, including the laser turning on slightly too late.

Any thoughts?

Offline Tweakie.CNC

*
  • *
  •  8,016 8,016
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #3 on: November 27, 2016, 02:51:02 AM »
That's interesting, where exactly are you adding this delay ??

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #4 on: November 27, 2016, 03:43:26 AM »
The blue box is what I'm talking about.



We are both using ESS's from Warp9. This menu is found under "Plugin Control"

Offline Tweakie.CNC

*
  • *
  •  8,016 8,016
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #5 on: November 27, 2016, 04:35:53 AM »
OK, you are using the ESS, it all makes sense.

Next question, are you still using a relay for switching your laser ?

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #6 on: November 27, 2016, 10:10:00 AM »
My machine uses an ESS, and two Gecko G540's. Nema 23. Slaved X/A axes. Output one activates the 1st output on my 1st g540. This is where the M11P1 comes in. Mine has no issues.

My buddies machine has an ESS, but uses the CRP560 from CNCrouterparts. He bought their plug and play electronics bundle. It's Nema 34. His is also output 1, using the M11P1.

I believe both of our controllers use relays to trigger the outputs. We are no longer using the work-around with an external relay.

He only has an issue once the "delay" is changed away from 0.
« Last Edit: November 27, 2016, 10:13:07 AM by frarebear »

Offline Tweakie.CNC

*
  • *
  •  8,016 8,016
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #7 on: November 27, 2016, 11:13:41 AM »
Output 1 from a G540 will be a TTL level signal which is electronically switched and should have no discernable delay provided the M11/M10 commands are always directly followed by an axis movement.
The CRP560 does contain mechanical relays and if one of these relays is being used to switch a laser then it will cause sufficient delay to produce a late start and also an unwanted burn at the end of each line.

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #8 on: November 27, 2016, 11:56:55 AM »
Thanks a ton for the info!! Very good to know.

Do you know why changing the delay settings under the ESS config would cause his to behave erratically and cut holes in the wrong places?

Mine has no issue

Offline Tweakie.CNC

*
  • *
  •  8,016 8,016
  • Super Kitty
    • View Profile
    • Tweakie.CNC
Re: M-code to turn laser on/off - Can my macro execute any faster?
« Reply #9 on: November 28, 2016, 02:56:49 AM »
Quote
Do you know why changing the delay settings under the ESS config would cause his to behave erratically and cut holes in the wrong places?

I have absolutely no idea so this question may be better asked on the Warp9 forum; http://www.warp9td.com/index.php/kunena/index

(They would need to know the Mach3 version being used together with Smooth Stepper firmware and software versions etc. If it is a known issue then I am sure there will be a solution).

Tweakie.
Success consists of going from failure to failure without loss of enthusiasm.  Winston Churchill.