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?
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.
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse at rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B