Toggle Flood with One Button

More
14 Jun 2011 18:01 - 15 Jun 2011 11:31 #10494 by BigJohnT
This example shows you how to toggle the flood coolant with a single button. It can be a physical button or a pyvcp button or both if you add and or2 to use either button. In this example I used a pyvcp button.
# Flood Coolant Toggle
net coolant-btn and2.0.in0 <= pyvcp.coolant
net coolant-ok and2.0.in1 <= halui.machine.is-on
net coolant-request toggle.0.in <= and2.0.out
net coolant-toggle toggle2nist.0.in <= toggle.0.out
net coolant-is-on toggle2nist.0.is-on <= halui.flood.is-on
net coolant-on halui.flood.on <= toggle2nist.0.on
net coolant-off halui.flood.off <= toggle2nist.0.off

The image shows the basic connections. It breaks down like this:
If the button is pushed AND the machine is on then input to toggle is on.
When toggle input is on change the output state
When toggle out is on toggle2nist input is on.
When toggle2nist in changes states
If coolant is on output off
If coolant is not on output on



John
Attachments:
Last edit: 15 Jun 2011 11:31 by BigJohnT. Reason: typo

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

More
15 Jun 2011 10:12 - 15 Jun 2011 10:54 #10524 by piasdom
now dats some good xplaneing.
gonna see if it can use it on my on/off - run/stop pyvcp button.
Great Job ! T'anks !



p.s. edited - your toggle(in file, not pic) are mismatched?
Last edit: 15 Jun 2011 10:54 by piasdom.

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

More
15 Jun 2011 11:00 #10526 by BigJohnT
piasdom wrote:

p.s. edited - your toggle(in file, not pic) are mismatched?


What do you mean?

John

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

More
15 Jun 2011 11:22 - 15 Jun 2011 11:26 #10528 by piasdom
well, i got the below to work but there's a slight delay
for my led to change. but other then that, it works.
THANKS John !
will be testing to see it gets out of sync anywhere.


#power on/off
net power-btn and2.11.in0 <= pyvcp.on-off
net power-ok and2.11.in1 <= halui.program.is-idle
net power-request toggle.4.in <= and2.11.out
net power-toggle toggle2nist.2.in <= toggle.4.out
net power-is-on toggle2nist.2.is-on <= halui.machine.is-on
net power-on halui.machine.on <= toggle2nist.2.on
net power-off halui.machine.off <= toggle2nist.2.off
Last edit: 15 Jun 2011 11:26 by piasdom.

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

More
15 Jun 2011 11:29 #10529 by piasdom
shouldn't toggle be toggle.0.in and toggle.0.out ?




yours:

net coolant-request toggle.0.in <= and2.0.out
net coolant-toggle toggle2nist.0.in <= toggle.1.out

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

More
15 Jun 2011 11:31 #10530 by BigJohnT
Yes, that was a good catch on that typo. Sometimes you can't see the forest for the trees... or something like that.

Thanks
John

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

More
15 Jun 2011 11:37 #10531 by BigJohnT
Not sure that I would use halui.program.is-idle for your power on/off as it is true even if the e-stop is active which means you can't turn the power on in that state. I would use halui.estop.is-activated with a not to invert the state of the pin as part of my and2.

John

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

More
15 Jun 2011 11:43 #10532 by piasdom
no biggie, i know it's correct in your working file or it wouldn't work :)

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

More
15 Jun 2011 11:55 #10533 by piasdom
BigJohnT wrote:

Not sure that I would use halui.program.is-idle for your power on/off as it is true even if the e-stop is active which means you can't turn the power on in that state. I would use halui.estop.is-activated with a not to invert the state of the pin as part of my and2.

John


cool. i'll try that.

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

More
15 Jun 2011 15:44 #10534 by piasdom
could i use toggle instead. not.0 slows emc a lot
and what about using iocontrol.0.user-request-enable
to change state with toggle ?

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

Time to create page: 0.131 seconds
Powered by Kunena Forum