Sign in to follow this  
Followers 0
Mr JJ

One Pb-----latch/unlatch

8 posts in this topic

Any ideas on logic how to set and reset an output bit with one momentary input bit. I have done it with four rungs. I would like to do it with less. Thank you all

Share this post


Link to post
Share on other sites
one rung ... three instructions ... but I'm not saying that it's pretty ... Edited by Ron Beaufort

Share this post


Link to post
Share on other sites
Two rung version Pushbutton is B3:0/0 and toggle output is N7:0/1

Share this post


Link to post
Share on other sites
Try looking here, but it's more of what has already been offered up. http://www.patchn.com/flipflop.htm

Share this post


Link to post
Share on other sites
Heres mine Edit - Ron, you beat me on this one! Along with a few others while I was talking to someone but Ron knows what I am talking about Edited by TWControls

Share this post


Link to post
Share on other sites
I liked TechJunki's answer so I modified it to put it on 1 rung and removed the one-shot bit (only one temp bit required) ... for no particular reason. I personally use: SOR XIC I:1.0/0 OSR B3:0/2 BST XIC B3:0/0 OTE B3:0/1 NXB XIC B3:0/1 OTU B3:0/0 NXB XIO B3:0/1 OTL B3:0/0 BND EOR because I thnk it's the most clear for maintenance personel. The first branch takes a copy of the bit and the second and third branches modify the original based on the copy.

Share this post


Link to post
Share on other sites
use the button to advance a counter, then use the counter.acc/0 (lowest Bit) to toggle the output Once the counter reacheches Max value, it will go Min value by itself, so no worries.

Share this post


Link to post
Share on other sites
You guys beat mine which is clear but ugly...in pseudo-code: <trigger><one shot> if toggle=true, set temp If temp=true, unlatch toggle If temp=false, latch toggle The temp bit just holds the toggle bit state so that the toggle bit can be correctly set.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0