Almost OT: Pushbutton switch latching
Sridhar Ayengar
ploopster at gmail.com
Wed Dec 5 15:01:27 CST 2007
der Mouse wrote:
>> Picture this - a number of switches, say, eight. Momentary contact,
>> normally open switches. And then eight outputs, one for each switch,
>> TTL level. I want to be able to push one switch and bring [its]
>> corresponding output high, and have it stay high even when the switch
>> is released. But, making this more complicated, I only want to be
>> able to allow one switch to be active at a time. So, say switch four
>> is pressed, output four is high. Then, switch one is pressed, and
>> output four goes low, and output 1 goes high. Timing is not
>> critical.
>
> Do you care what happens if two switches are pressed at once? In
> particular, do you care what the outputs are like during the time when
> both switches are pressed? Do you care what the state is like on
> powerup, before any switches are pressed?
Couldn't one just hypothetically feed all of the switch outputs through
a bunch of XORs and then AND the output of the XOR array with each of
the outputs of the flip-flops you suggest below? Or am I
overcomplicating the problem?
> My first cut would be to set up a bunch of R-S flipflops (each one
> being two cross-coupled NAND gates, probably). A switch would then
> drive low the S input for its flipflop and the R input for all other
> flipflops. (How this is done is more or less irrelevant. Personally,
> I'd probably put pullups on the inputs (omittable if they're true TTL,
> as opposed to something like HCT which is TTL-level but not real TTL)
> and then have each switch ground the cathode side of a diode matrix
> which then pulls the relevant inputs low. If you want to "do it right"
> you'd need a bunch of 8-input AND/NAND gates - you might even make the
> flipflops out of those, with one input of each flipflop dedicated to
> each switch.)
>
> If you care about power-up state I'd probably add some kind of
> discrete-component circuit to fake pressing a switch for a brief time
> during powerup. I can see a possible way to do it with a diode, a
> transistor, a resistor, and a capacitor....
>
> Another possible solution is to feed the raw switch bits into a
> priority encoder chip, latch the resulting encoded bits, and feed the
> latch outputs into an N-to-one demux chip.
This is the method I would normally choose.
Peace... Sridhar
More information about the cctalk
mailing list