Machsupport Forum
Mach Discussion => Mach4 General Discussion => Topic started by: daniba73 on November 09, 2018, 04:04:03 AM
-
Hi everyone
Is it possible to add a sound to the "Change tool" LED?
A simple "beep" at every impulse would be excellent.
Mach4 starts with a 100% slide Rapid Rate
Is it possible to change this condition and start with 25%?
-
You can have your Rapid Rate Override set to 25% in the PLC script on start up.
Put this code in the PLC Script from the screen editor.
--Featured added 11-9-18
--Set RRO to 25% on start up
if testcount == 1 then
mc.mcCntlSetRRO(inst, 25)
end
As far as playing a tone off the computer through speakers, I'm not sure, someone else would need to help you with that.
But, I have Stack Lights that have buzzers integrated in them on our machines here at the shop, you can use the "Tool Change" output in the mach configuration and map it to a relay that runs a buzzer or beeper. You can get simple buzzers on ebay or places like Automationdirect.com.
-
local snd=wx.wxSound('c:\\Windows\\Media\\chord.wav',0)
snd:Play()
HTH
RT
-
RT,
So... snd:Play() plays the sound.
Does it play the file once and stop?
-
Hi,
I report this error.
unexpected symbol near 'if'
acoustic signal instructions where should I enter?
if I put it in PLC it will only sound when I open Mach4.
-
Sorry for the delay in response.
Make sure you put custom code towards the end of the PLC script.
That way you don't put it inside another section of code.
Also be sure that the comments have the "--" in front of them. That makes it a comment in LUA.
I forgot you want this to sound during your tool change.
You can still put this in your PLC Script. But now, you will need to get the handle of the Tool Change Output.
When the Tool Change Output is active, play the sound.
I will see if I can get this to work on my computer in the sim and post my findings.
-
Hi,
It's not a problem, I'm not in a hurry.
the error report was referred to this:
--Featured added 11-9-18
--Set RRO to 25% on start up
if testcount == 1 then
mc.mcCntlSetRRO(inst, 25)
end
-
That's the exact code I've got in my PLC script and it is working fine.
Did you put it at the end to make sure it isn't inside another bit of code?
-
Hi,
Yes sure
I attach image.
-
Hmm..
Try and take the code out of the PLC Script to see if you are still getting the error.
I moved my code to the top of the PLC script to be sure it was still working; it is.
-
YESSSS !! It works!!
I inserted script in the wrong page !!
now it's in the right place, it's all OK!
the translator helps a lot, but there is always a bit of difficulty in understanding well.
Thank you so much!!
-
Awesome! Glad you got it working!
=)
-
I noticed that the M8 function is deactivated only with M9 or the corresponding screen button.
Both the RESET and ENAMLE buttons do not affect the status.
Is it normal or BUG of Mach4?
Is it possible to assign an external button?
-
No, it is not a bug. That is how Artsoft set it up in the default system.
I always add stuff to the Reset Button.
I actually add a Reset Function to the Screen Load script called "Reset()" I have a physical button on a control panel that I use as a Reset Button; then I put everything in this function that I want to happen when I hit the Reset Button.
Things like Turning off the Coolant, Mist, Stacklights, Etc...
But you can just add some script to the Reset Button.
To turn off the coolant use this script (Check the syntax and the mc call, I'm out of Mach4 right now, but I think this is right.)
local Coolant = mc.mcSignalGetHandle (inst, mc.OSIG_COOLANT)
mc.mcSignalSetState (Coolant, 0)
-
Hi,
Where should I enter this string?
also I would like to add to the RESET button stop coolant, how do you do it?
Mach4 is too complex to configure for many people.
-
You will put it inside the Reset Button.
Same as you enter in the PLC or Screen Load, it is in the second tab in the feature box.
There will be some script already in the button, just add this at the bottom of it.
Mach4, like anything new, requires patience and time to get an understanding of it.
I had no idea how to do anything in Mach4 when it first came out; I took time to learn it and understand what things did and how it all worked, there are still things I don't know how to do, but I will learn them.
-
surely I'm wrong ... I have a series of errors.
-
What are your errors?
-
I do not understand where you enter your string.
local Coolant = mc.mcSignalGetHandle (inst, mc.OSIG_COOLANT)
mc.mcSignalSetState (Coolant, 0)
in the RESET functions what should I write?
I attach image
-
I had the Output handle wrong in the code I gave you. I didn't think it was right, like I mentioned, needed to check that the signal call was all correct.
Put this code below the Set Last Error.
--Turn coolant off on Reset
local Coolant = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON)
mc.mcSignalSetState(Coolant, 0)
-
OK done.
now? what's next step?
I do not have to enter in the dedicated screen input?
-
If all you want is for the reset button to shut the coolant off, then you're finished. Just save that and test it.
Turn your coolant on and press the reset button; it will turn the coolant off.
-
tried on the computer at home and it works!
I try it on the lathe as soon as possible.
Is it possible to switch on or off with an external button?
Thank you for your great patience!
-
Yes. There is a thread on this forum with that information already. But the searching isn't working right now. I'll see if I can get some script I have on a machine on the is thread.
-
Hi,
Can you give me a clue where to look for this thread?
why does the "search" function no longer work?
-
Hi,
I had to suspend the tests due to work commitments.
Today I managed to turn on the lathe.
I entered the codes to disable M8 as described above.
I noticed that it goes off if I press STOP or RESET only with the muose on the screen of Mach4.
It has no effect if I press its external button on the panel.
How can I combine this function with external keys?
-
You have to add that functionality in the signal library for the your external reset button.
-
Hi,
could you give me an example, please?
P.S I found a connection discussion.
now I can turn on / off the refrigerant from the external button.
I insert links, as help for other people.
http://forum.machsupport.com/forum/index.php/topic,38386.0.html
-
That right there is your example.
You've figured it out with this example, however, instead of having it toggle coolant on and off, just keep it off.
So in your Reset Button Input, just add this part of code:
local OSigCool = mc.mcSignalGetHandle (inst,mc.OSIG_COOLANTON)
mc.mcSignalSetState(OSigCool,0)
--mc.mcCntlSetLastError(inst, "Coolant Off") --(this is just a message keep this if you like.)
This will turn it off and not toggle it on and off.
-
If just the reset button is all you want to use to turn the coolant off, then just add M9 to the Initialization codes in the configuration dialog. These two strings of G codes will be sent to the control every time the reset button is pressed. Or the mcCntlReset() API function is called.
Steve
-
OK, as you say it works.
the problem is that until you press ENABLE, the M8 function is active, so the pump works.
I would like Mach4 to start with the pump off.
-
there is no solution?
how can I assign M9 (to turn off the refrigerant) when I press ESTOP?
-
Put your E STop signal in the SigLib in the screen load script.
[mc.ISIG_EMERGENCY] = function (state)
if (state == 1) then
local Coolant = mc.mcSignalGetHandle(inst, mc.OSIG_COOLANTON)
mc.mcSignalSetState(Coolant, 0)
end
end,
-
I'm sorry, I forgot to answer.
IT WORKS!!
-
daniba,
(Is it possible to add a sound to the "Change tool" LED?
A simple "beep" at every impulse would be excellent.)
Did you get the sound to work when tool change led is flashing?
If so how... with details please
Thanks
-
No sorry.
I didn't make any changes, I just left the LED.
I intended to parallelize a buzzer with the LED.
the two objects have different power supplies (led / buzzer) and I didn't know how to do it, so I left it unchanged.