Hello Guest it is November 20, 2019, 05:55:35 PM

Author Topic: Keyboard M-function?  (Read 3489 times)

0 Members and 1 Guest are viewing this topic.

Keyboard M-function?
« on: November 10, 2015, 04:17:24 PM »
Is there a way to map the spacebar (or any other key) to activate a custom M function that I use? The M function is to activate a laser for spot welding the ends of the work down before the program welds the full profile.

Any suggestions would be appreciated.
Re: Keyboard M-function?
« Reply #1 on: November 10, 2015, 05:52:49 PM »
you can .... but it depends upon what codes are mapped within your screenset and what screen is on view at the time you are hitting the key....

The spacebar is not a good key to use as it normally has other functions (look for "space" / key "32" on these std screensets):
http://www.machsupport.com/Mach3Wiki/index.php?title=Standard_Hotkeys

How are you controlling your laser  (how do you toggle it on and off... which output are you using / do you have a button on the screen).

The reason why I ask is because if you were using the "plasma" screenset on that page you can see that if you hit the "F5" key it will toggle the plasma cutter on and off.... hence the button has been mapped to that key...

If you send me your screenset and tell me on what screen you want the button to toggle the laser on and off I'll change the button for you if you have one on the screen.

You can edit the screenset yourself using MachScreen http://www.kd-dietz.com/klausphp/pages/eng/machscreen/description/ms_description.html

Attached is a screenshot of my plasma screen.

Rob
Rob

Albert Einstein ― “If you can't explain it to a six year old, you don't understand it yourself.”

Offline BR549

*
  •  6,916 6,916
    • View Profile
Re: Keyboard M-function?
« Reply #2 on: November 10, 2015, 09:06:28 PM »
Anytime you use a hotkey to control a dangerous function you should use a 2 key solution. Set your hotkey to something like {Ctrl  L}   

Just a thought, (;-) TP
Re: Keyboard M-function?
« Reply #3 on: November 11, 2015, 12:51:08 AM »
Good point....
Rob

Albert Einstein ― “If you can't explain it to a six year old, you don't understand it yourself.”
Re: Keyboard M-function?
« Reply #4 on: November 11, 2015, 08:27:06 AM »
The laser I am using has a series of steps that have to happen before it will fire.

There are two logic lines going to a DB37 connected to the laser that have to be closed to a COM line in the laser.

I'm using the K1 (Output 1 in mach3) relay on  PMDX-126 as the laser stop and the K2 (Output 2 in mach3) relay as laser start. The sequence to make the laser fire is :

Activate K1
Pause >50ms
Activate K2
Pause >50ms
(Laser is firing at this time)
Deactivate K2
(Laser still firing)
Deactivate K1
(Laser stops firing)

The way I am controlling K1 and K2 is by having the two relays mapped to the spindle control and mist control respectively.

So to activate/deactivate K1 I call M3/M5
to activate/deactivate K2 I call M7/M9.

I've written an m-function to mirror the laser firing sequence above in the hopes that I could link it to a button on the keyboard so the welder can do his spot welds.

I'm not on the correct computer to copy my screenset, but I am using the standard mill screen currently. The laser is attached to a 4 axis mill that I re-purposed from an old sherline hobby set up.
Re: Keyboard M-function?
« Reply #5 on: November 11, 2015, 09:03:44 AM »
OK... The whole tack weld macro... What have you called it?

M??

I'd suggest adding a button to the screen...

Then assign the macro to the button and also a keypress

Two options...

Do it yourself and I'll lead you through it. (In about 6 HRS time)... You will need to download and install machscreen on your machine (or a clone... I run a laptop as a clone and my dedicated machine lives in the garage)

Or send me your screenset, use a snapshot tool and show me where you want the button, what keypress you want and tell me what the tack weld macro is called and I'll do it for you this evening (UK time for me).

Rob
Rob

Albert Einstein ― “If you can't explain it to a six year old, you don't understand it yourself.”
Re: Keyboard M-function?
« Reply #6 on: November 11, 2015, 03:24:43 PM »
Thank you for the offer Rob, I think I'll take you up on it. Sorry it took so long to reply, been a crazy day here today.

I've attached a snapshot of my screen set. I believe it is just the standard mach3 mill screen set as I haven't changed anything.

As far as where I'd like the button, I think it would go nicely in the box that now has the spindle speed. Our machine does not have a spindle at all so that information is unnecessary anyway.

A button for Laser Fire there would be great, and maybe a light indicating that the laser is currently firing (if possible).

The m function I have written is labeled as m1000 in the  mach directory. I think I'd still like the spacebar to be the keyboard hotkey though. I have wired an external pause button already (although I probably wouldn't have had I read the hotkey list before).

Thanks again!
Re: Keyboard M-function?
« Reply #7 on: November 11, 2015, 08:59:18 PM »
The LED won't work yet....

But the spacebar should run M1000

Can you send me your macro please (attached is one I did earlier...)


You will need to save the screenset (1024.set) to the Mach3 folder (c:/Mach3/)   
[I'd suggest renaming your existing screenset 1024.set to 1024-old.set .... that way you can always change it back .... should I have cocked it up!]

You will need to save the BackgroundMain-Laser.jpg to the following folder: C:\Mach3\Bitmaps\MillBitmaps

You will need to save the FeedHold-F.jpg to the following folder: C:\Mach3\Bitmaps\MillBitmaps

I've added my attempt at an M1000 macro for you that should run the LED .... but you will need to check and test it .... (if you have a working one .... send it across and I'll have a look or you can add the SetUserLED function to yours.... the if statement is kind of a safety feature.... dont want to be able to press the spacebar and the laser fires .... despite being in estop... or if the machine is actually moving.... hence you need to be stopped for it to fire (which is what I expected you wanted for a spot weld.

... you will need to add the Macro to the Macros folder ..... but within your profile (whatever you've called it) .... may want to change the name of your current one to M1000-old... just in case mine does not work..... suggest you have a look at it before trying it obviously...

Rob
Rob

Albert Einstein ― “If you can't explain it to a six year old, you don't understand it yourself.”
Re: Keyboard M-function?
« Reply #8 on: November 14, 2015, 04:59:13 AM »
Rob

Albert Einstein ― “If you can't explain it to a six year old, you don't understand it yourself.”
Re: Keyboard M-function?
« Reply #9 on: November 16, 2015, 08:06:50 AM »
Rob,

Sorry for the lack of information. To be honest I have not had a chance to upload the files and give it a try. I've been putting out fires at work for the last several days (the wonderfulness of manufacturing engineering). I'll see if I can get it online this morning barring anything else happening.