Hi guys I would like to add a momentary button on one of my screens in myCNC. This is to be able to reset and enable the servo drives.
the button must activate one of the onboard relays for 2 seconds and then release the relay again. I have got a toggle switch to work but battling with a momentary one
Momentary button
Re: Momentary button
Hello there,
I'd recommend using a Software PLC which will toggle an output, with a 2 second timer. Here is an article that goes into detail explaining how to add a button with an LED indicator for a particular port: http://docs.pv-automation.com/plc/butto ... indication
The article is using screenshots from an older software version, however the basic idea is the same. This video also goes into detail about adding a button to the software's screen to launch a software PLC (please note however that this one lacks an LED indicator, you need to use an xbutton for that, as shown in the manual above): https://www.youtube.com/watch?v=uII_1znYNE4
For the software PLC itself, you can easily insert a timer using a code that would be similar to this:
Here I am using output port 3 which will be toggled on and off, feel free to change the code to suit your particular configuration. Let me know if that helps.
I'd recommend using a Software PLC which will toggle an output, with a 2 second timer. Here is an article that goes into detail explaining how to add a button with an LED indicator for a particular port: http://docs.pv-automation.com/plc/butto ... indication
The article is using screenshots from an older software version, however the basic idea is the same. This video also goes into detail about adding a button to the software's screen to launch a software PLC (please note however that this one lacks an LED indicator, you need to use an xbutton for that, as shown in the manual above): https://www.youtube.com/watch?v=uII_1znYNE4
For the software PLC itself, you can easily insert a timer using a code that would be similar to this:
Code: Select all
main()
{
portset(3);
timer=20;
do
{
timer--;
}while(timer>0);
portclr(3);
exit(99);
};