3 way latching switch (Or "ternary flip-flap-flop")

Thread Starter

SimL

Joined Jan 15, 2015
7
Hi,

Last year I built a simple SR latch circuit (with two NAND gates) to switch between two pair of speaker with relays, in my home studio. The latch circuit activated a relay + a LED in the pushbutton switch.

It works really well: when I press the first pushbutton, it lights up, and the audio signal is routed to the first set of speakers via relays. When I press the second pushbutton, it lights up and turns off the first, and the audio signal is routed to the second set of speakers. And vice versa... as a simple SR latch is supposed to do.

Now I have a 3rd pair of speakers, so I want to make a 3 way latch circuit that works just like the SR latch, but can't find any way to build it...

The only relevant information I found is this. But it's only a block diagram, it won't show how to do it. A couple of logic gates? Or a chip?

I've tried in a simulator with all sorts of combinations, 3 gates of 3 inputs of all sorts, but nothing worked. I'm pretty sure there's a way to do it, and I must not be the only one who tried this... But I can't get my head around this "logic puzzle"!!

What would be the simplest possible way to make a 3 way latching circuit, also called a "flip-flap-flop"?

Thanks in advance,
 

Thread Starter

SimL

Joined Jan 15, 2015
7
UPDATE:

On the link I posted, I read fast, I thought it was a block diagram, but it is 3 input NOR gates. I tried it in a simulator, and it almost worked, as the C output will never be high... (image attached)

Almost there, but not quite.... (why doesn't it work, it seems super logical??)
 

Attachments

ErnieM

Joined Apr 24, 2011
8,377
I have not seen such a circuit.

To do something like this I would use 3 conventional flip flops. Each one of 3 buttons would set one flip flop while resetting the other two.

You would also need something to insure only one flip flop (or none) is on when you first turn this on.
 

crutschow

Joined Mar 14, 2008
34,280
Here's a circuit I put together that does the Radio PB function, which is what you want.
It's perhaps overkill since it will handle 2 to 8 PBs (or even 16) but it's reasonably simple, requiring only 2 ICs, so you may want to consider it.
 
Last edited:

Thread Starter

SimL

Joined Jan 15, 2015
7
Cool, thanks for the fast answer guys!!

Crutschow's design looks really neat and simple, perfect when more than 4 options is needed. Really well explained, I am considering it. :)

Nykolas' design looks cool and simple as well... Good to know that a quad SR Latch exists. I have some questions about the design, though:

-There's 4 outputs, one "off" and 3 "programs", are they just names but in the end the 4 outputs are the same?
-I assume the 4 input NAND gates are for resetting the other latches, but why two cascaded gates? The second one is an inverter? Why not use a 4 input AND gate instead? And why the .01uF cap between the two? Looks like a coupling cap, as in a class A amplifier design... Does it have a similar function? Can this part be done in a simpler way?
-Why darlington transistors instead of BJTs? More power for the relay coils?

In general, with relays:
-What's the difference between 12V relays, 9V or 5V relays? Am I right to say they just different choices to adapt different chosen voltage rails, so using a simple 5V relays can be as efficient? (Since logic ICs vcc are 5V)

Thanks guys!
 

crutschow

Joined Mar 14, 2008
34,280
Crutschow's design looks really neat and simple, perfect when more than 4 options is needed. Really well explained, I am considering it.
It will work fine with just 3 inputs, of course.
I assume the 4 input NAND gates are for resetting the other latches, but why two cascaded gates? The second one is an inverter? Why not use a 4 input AND gate instead? And why the .01uF cap between the two? Looks like a coupling cap, as in a class A amplifier design... Does it have a similar function? Can this part be done in a simpler way?
Yes, the second is just an inverter. You could use one AND gate instead.
The capacitor performs a RC differentiate function to generate a short (one-shot type) reset signal from the leading edge of the PB pulse to reset all the latches.
In general, with relays:
-What's the difference between 12V relays, 9V or 5V relays? Am I right to say they just different choices to adapt different chosen voltage rails, so using a simple 5V relays can be as efficient? (Since logic ICs vcc are 5V)
The difference is the relay pull-in voltage and the coil resistance (current).
Lower voltage relays of the same type require more coil current to operate.
 

Thread Starter

SimL

Joined Jan 15, 2015
7
Thanks Crutschow.

The capacitor performs a RC differentiate function to generate a short (one-shot type) reset signal from the leading edge of the PB pulse to reset all the latches.
Oh, that makes sense! Didn't saw the RC configuration right away, as simple as it is.

But what is the advantage of having a very short reset signal instead of the pushbutton directly?
 

hp1729

Joined Nov 23, 2015
2,304
Hi,

Last year I built a simple SR latch circuit (with two NAND gates) to switch between two pair of speaker with relays, in my home studio. The latch circuit activated a relay + a LED in the pushbutton switch.

It works really well: when I press the first pushbutton, it lights up, and the audio signal is routed to the first set of speakers via relays. When I press the second pushbutton, it lights up and turns off the first, and the audio signal is routed to the second set of speakers. And vice versa... as a simple SR latch is supposed to do.

Now I have a 3rd pair of speakers, so I want to make a 3 way latch circuit that works just like the SR latch, but can't find any way to build it...

The only relevant information I found is this. But it's only a block diagram, it won't show how to do it. A couple of logic gates? Or a chip?

I've tried in a simulator with all sorts of combinations, 3 gates of 3 inputs of all sorts, but nothing worked. I'm pretty sure there's a way to do it, and I must not be the only one who tried this... But I can't get my head around this "logic puzzle"!!

What would be the simplest possible way to make a 3 way latching circuit, also called a "flip-flap-flop"?

Thanks in advance,
Re: flip flap flops
What is so profound. It is called "Radio Buttons. Like car radio channel selectors.
 

Attachments

Last edited:

AnalogKid

Joined Aug 1, 2013
10,986
This is a variation of a game show circuit, something that latches on the first button pressed. Lotsa examples on the net. However... I direct selection a requirement? In other words, would a single-button stepping selector circuit be good enough? If so, look at the CD4017. This is a decade counter already decoded into 10 outputs that are stepped through with each clock pulse. Tie output #3 to the reset and you have a 3-stage stepper. There is a little bit more to a complete circuit, but not much.

ak
 

crutschow

Joined Mar 14, 2008
34,280
........................
Oh, that makes sense! Didn't saw the RC configuration right away, as simple as it is.

But what is the advantage of having a very short reset signal instead of the pushbutton directly?
The advantage is, it won't work otherwise. :rolleyes:
If you reset all the latches with the PB directly then the latch you are trying to set would have a simultaneous set and reset signal, so its output would be indeterminate when the PB is released.
 

Thread Starter

SimL

Joined Jan 15, 2015
7
What is so profound. It is called "Radio Buttons". Like car radio channel selectors.
Exactly what I want! Super profound, eh! :D
I thought you were the winner for the simplest circuit of this thread as it seems exactly what I'm searching for, but when I try it on the Falstad Java Circuit Simulator here, it doesn't work at all! The two input NAND gate will never give a low output, since the other input seems to stay low... Is your circuit incomplete, and has some parts that are taken for granted? Kind of a "EE slang"? (lol)

However... I direct selection a requirement? In other words, would a single-button stepping selector circuit be good enough?
Direct selection a requirement, yes. I want to be able to go from pair 1 to pair 3 with a single button, for example. And at a glance, with an illuminated pushbutton, see which is turned on.

______

I know I might be complicating myself for nothing, as I could have 3 switches that routes the signal to each pair of speakers, like this overwhelmingly super simple product. This is my "plan C" to make one like that. However, I find pushbuttons and latching circuits far more classy and fun, so why not!! :D

I thought it would only be a super simple "logic-gates puzzle" to go from a 2 way latch to a 3 way, but it seems a little more complex than that.
However, the 4532&4514 (crutschow's circuit) or the 4044 (Nykolas') will do the job juuust fiiine. :cool:

Thanks for your help y'all, but if somebody has a way to do it that works with a couple of gates only, as in hp1729's or the link I posted at the beginning of this thread, I'm curious!
 

crutschow

Joined Mar 14, 2008
34,280
You may need to add pull-down resistors to the input for the simulation of hp1729's circuit.
Resistors would certainly be required in any real circuit since an open input is undefined (not necessarily a logic 0).
 

Thread Starter

SimL

Joined Jan 15, 2015
7
You may need to add pull-down resistors to the input for the simulation of hp1729's circuit.
Resistors would certainly be required in any real circuit since an open input is undefined (not necessarily a logic 0).
Even there... I've added them here

I found on the Falstad Circuit Simulation, we can put "logic input" component, that has "L" for low and "H" for high, and work like a pushbutton. More clean drawing, but still doesn't work, I did it here

PS: How cool is that, a Java Circuit Simulator that can "run" in real time, see voltages and currents.. I knew it for a while, and for educational purposes, it's really cool. I tried by trial & error all kind of logic gates combinations to find an answer to my question...

Plus, I found yesterday that we can
"export circuit as a link".... for sharing in a forum like AAC, it's friggin awesome!!!!!!!!!!
 

AnalogKid

Joined Aug 1, 2013
10,986
Here is a generic, one-chip, latching switch interface with open switch line termination, switch debounce, etc. Mutual exclusivity is left to the operator. With different latch chips and resistor networks it can be shrunk down to 2 inputs or expanded to 16 inputs or more. The 2N7002 is on one output as a relay driver example.

ak
SelectorSwitchLatch-1-c.gif
 

Attachments

crutschow

Joined Mar 14, 2008
34,280
I like the simplicity of your circuit, ak.
But for reliable clock operation it specs a minimum rise-time of 4μs to 15μs depending upon the supply voltage, so it needs a debounce circuit that generates a fast rise time but a slow decay time.
A series capacitor with a diode across it should work.

Other ICs that could be used are the 4174 Hex-D FF and the 4175 Quad-D FF.
 

hp1729

Joined Nov 23, 2015
2,304
Exactly what I want! Super profound, eh! :D
I thought you were the winner for the simplest circuit of this thread as it seems exactly what I'm searching for, but when I try it on the Falstad Java Circuit Simulator here, it doesn't work at all! The two input NAND gate will never give a low output, since the other input seems to stay low... Is your circuit incomplete, and has some parts that are taken for granted? Kind of a "EE slang"? (lol)



Direct selection a requirement, yes. I want to be able to go from pair 1 to pair 3 with a single button, for example. And at a glance, with an illuminated pushbutton, see which is turned on.

______

I know I might be complicating myself for nothing, as I could have 3 switches that routes the signal to each pair of speakers, like this overwhelmingly super simple product. This is my "plan C" to make one like that. However, I find pushbuttons and latching circuits far more classy and fun, so why not!! :D

I thought it would only be a super simple "logic-gates puzzle" to go from a 2 way latch to a 3 way, but it seems a little more complex than that.
However, the 4532&4514 (crutschow's circuit) or the 4044 (Nykolas') will do the job juuust fiiine. :cool:

Thanks for your help y'all, but if somebody has a way to do it that works with a couple of gates only, as in hp1729's or the link I posted at the beginning of this thread, I'm curious!
Re: low out
True, it is a high out. If you need a complete circuit hold on a minute.
Okay, 3 ICs. Relays of your choice. I didn't know what kind you had in mind.
Disadvantages ... no "off" option. Some set is always selected.
It was done in TTL, but can be converted to CMOS easily.
 

Attachments

Last edited:

crutschow

Joined Mar 14, 2008
34,280
Re: low out
True, it is a high out. If you need a complete circuit hold on a minute.
Okay, 3 ICs. Relays of your choice. I didn't know what kind you had in mind.
Disadvantages ... no "off" option. Some set is always selected.
It was done in TTL, but can be converted to CMOS easily.
Have you actually gotten that circuit to work? :confused:
I can't get it to operate in LTspice.
 

AnalogKid

Joined Aug 1, 2013
10,986
I like the simplicity of your circuit, ak.
But for reliable clock operation it specs a minimum rise-time of 4μs to 15μs depending upon the supply voltage, so it needs a debounce circuit that generates a fast rise time but a slow decay time.
Always dangerous to disagree with Wally, but (assuming you meant a maximum rise time...) ...

Nope. Your statement is correct for normal latch operation, but in this case there is no penalty for the internal clock edge oscillating briefly due to a slow input risetime. And speeding up the attack edge puts it within the switch bounce period, leading to random results. As long as the switch is stable before the latch calms down, don't care about either. The "right" way is to use the first switch edge to start a 20-50 ms monostable, and have its trailing edge pulse the clock. But empirical data says this circuit has worked as is for a couple of decades.

ak
 
Last edited:

crutschow

Joined Mar 14, 2008
34,280
Always dangerous to disagree with Wally, but (assuming you meant a maximum rise time...) ...

Nope. Your statement is correct for normal latch operation, but in this case there is no penalty for the internal clock edge oscillating briefly due to a slow input risetime. And speeding up the attack edge puts it within the switch bounce period, leading to random results. As long as the switch is stable before the latch calms down, don't care about either. The "right" way is to use the first switch edge to start a 20-50 ms monostable, and have its trailing edge pulse the clock. But empirical data says this circuit has worked as is for a couple of decades.
Ah, I got my minimums and maximums mixed up again. :oops:

So you are saying the circuit works with a clock rise-time much slower than the spec. (?)
Well, that may work in a single case, but it's certainly not good design. :eek:
As you say, the correct way is to use a delayed trigger for the clock, That could be done with an RC delay into a Schmitt trigger gate such as the 4093 or 4106.
 
Top