Allen Nelson
Member
For those who have mastered the flip-flop (aka: toggle an output with a single pushbutton), I needed a variation on it.
I've got a motorized valve, with separate OPEN and CLOSE outputs, and I wanted to control it with only 2 pushbuttons. It's easy to do if the pushbuttons are programmed "jog" style - Energize the OPEN output while the OPEN_PB is pressed, etc.
But I wanted to do the following:
I whipped up something pretty quick, but didn't like the look of it - it relied heavily on one-shots. The PB's are on an HMI, and although I convert all HMI commands to one-shots, because of asynchronous scanning, those oneshots are really, what I call, one-and-a-half shots (i.e., they can be on from anywhere from 1 to 2 scans). Normally it doesn't matter, but here it would, and so I'd have to oneshot my "oneshots", which seemed wrong.
So, I brushed up on all the Karnaugh map lessons, and did the code the RIGHT way (if there is such a thing).
So I just want to express my thanks to Terry & the Pirates (- am I dating myself with that allusion?) and to Archie Jacobs (whom I haven't seen around in a while).
I invite others to post their solution (I'm always on the lookout for new code - I'll plagiarize anything worthwhile. Code I've gotten on this site has saved my, -er-, performance review, a number of times.)
If there's interest, I'll post my solution (along with a step-by-step of how I approached it).
Allen
I've got a motorized valve, with separate OPEN and CLOSE outputs, and I wanted to control it with only 2 pushbuttons. It's easy to do if the pushbuttons are programmed "jog" style - Energize the OPEN output while the OPEN_PB is pressed, etc.
But I wanted to do the following:
- Pressing (and releasing, eventually) the OPEN_PB energizes the OPEN output.
- Pressing the CLOSE_PB halts the open operation, keeping the valve in place.
- Pressing the CLOSE_PB starts the valve closing.
- But if OPEN_PB had been pressed, the valve would have started opening again instead.
Etc.
I whipped up something pretty quick, but didn't like the look of it - it relied heavily on one-shots. The PB's are on an HMI, and although I convert all HMI commands to one-shots, because of asynchronous scanning, those oneshots are really, what I call, one-and-a-half shots (i.e., they can be on from anywhere from 1 to 2 scans). Normally it doesn't matter, but here it would, and so I'd have to oneshot my "oneshots", which seemed wrong.
So, I brushed up on all the Karnaugh map lessons, and did the code the RIGHT way (if there is such a thing).
So I just want to express my thanks to Terry & the Pirates (- am I dating myself with that allusion?) and to Archie Jacobs (whom I haven't seen around in a while).
I invite others to post their solution (I'm always on the lookout for new code - I'll plagiarize anything worthwhile. Code I've gotten on this site has saved my, -er-, performance review, a number of times.)
If there's interest, I'll post my solution (along with a step-by-step of how I approached it).
Allen