Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Best "radio button" latching circuit

Status
Not open for further replies.

throbscottle

Well-Known Member
I designed a latching circuit to encode 16 momentary buttons to bcd, then I found another one on the internet. I haven't had a chance to test either yet.

My version uses R-S flip-flops, creating a small delay to set each flip-flop after they have all been reset (component values are fairly arbitrary at this stage) (and I haven't given it a "zero" button, and missed out the switch symbols since LTSpice doesn't have one)

The AND gate version I found latches using positive feedback, and is from here: **broken link removed**

Both circuits create 2 diode drops between each switch and input.

Question is, which is best?

Cheers
throbscottle
 
They seem similar in parts and complexity so I can't readily say which is best.

But seeing all those diodes and the large amount of soldering required got me to thinking about a scanning type design that would require no steering diodes. After a few iterations on the simulator I came up with the design below.

The clock signal from the 555 astable causes the CD4516 binary counter to continually cycle through its 16 states. The 4-bit binary counter output goes to a CD4514 4-to-16 decoder and to 4 D-Flipflops. When a PB connected to the decoder output is depressed, the pulse from that output is used to latch the binary counter value of that PB position into the D-Flipflops.

I ran into some timing race problems so the CD4011 was added to give a clock pulse to the Flipflops in the middle of the decoder output pulse and avoid any glitches. The simulator allowed me to find that out before its built.

Instead of using two CD4013 flipflop packages, you could use one CD40174 Hex D-Flipflop. I didn't have a model for that in my simulator (Electronic Workbench) so had to use the CD4013 for the simulations.

Also, if you need 10 or less push-buttons, you could use a CD4028 decimal decoder in place of the CD4514, which has the advantage of being in a smaller package.

Note that only four push-buttons are shown. You need to expand that to the number of push-buttons you want.

View attachment 65443
 
Last edited:
I'm completely impressed and wish I'd had the idea myself - thank you! Is it okay if I use this (in an open dmm project)?
 
You might look at using a priority encoder as the front end. Parts to look at include:
CD4532b
74HC147
74HC148
 
You might look at using a priority encoder as the front end. Parts to look at include:
CD4532b
74HC147
74HC148

Thanks for this - I'd looked at (de)multiplexers briefly, (based on what's in my junk box, which ain't much) but the thing that stumbled me was the need to latch the output.
 
Thanks for this - I'd looked at (de)multiplexers briefly, (based on what's in my junk box, which ain't much) but the thing that stumbled me was the need to latch the output.

Figure 2 of TI's sn74hc148 datasheet shows how to use two of them for 16 inputs. The priority flag signal, with a small delay, should be able to strobe a latch to store the Q outputs. The delay will help with debouncing too.
 
I'm completely impressed and wish I'd had the idea myself - thank you! Is it okay if I use this (in an open dmm project)?
Be my guest. :)

Edit: throbscottle's idea of using a priority encoder should also work. It's advantage would be that it can be designed is a static circuit which doesn't require a clock. It wouldn't necessarily be simpler however, since 16 inputs requires 3 chips for the priority encoding plus the latch.
 
Last edited:
Ok, I had to try the priority encoder circuit also. It's shown below with a CD4532 encoder and a CD4042 4-bit latch. There shouldn't be a race problem with the latch since the GS output delay is less than the decoded output delay (and the latch latches on the falling edge of the clock [GS] input).

I show five push-buttons but it can be expanded to eight. To go to sixteen you need to use the circuit shown in Figure 15 of the CD4532 data sheet for a 16-input encoder. So take your pick. ;)

View attachment 65458
 
Last edited:
Ok, I had to try the priority encoder circuit also. It's shown below with a CD4532 encoder and a CD4042 4-bit latch. There shouldn't be a race problem with the latch since the GS output delay is less than the decoded output delay (and the latch latches on the falling edge of the clock [GS] input).

I show five push-buttons but it can be expanded to eight. To go to sixteen you need to use the circuit shown in Figure 15 of the CD4532 data sheet for a 16-input encoder. So take your pick. ;)

Even better :)

(but credit where it's due, it was ChrisP58's idea to use a priority encoder, not mine!)

Well, I have plenty to work with now - massive thanks to both of you :D
 
Even better :)

(but credit where it's due, it was ChrisP58's idea to use a priority encoder, not mine!)

Well, I have plenty to work with now - massive thanks to both of you :D
Yes it was Chris's idea. I looked at the wrong post. :eek:
 
HMmmm, I've thought of the 148 priority encoder as a mutual exclusion key encoder, but wasn't good the following. That on near simultaneous hits, the encoder will prefer the lower # hit as first. I've gone with a sufficiently high speed clock (1-10MHz) on J-K flip-flops to log & lockout key hits.

Depending on your uC, you can turn on the clocking & get your response as required; no debouncing involved, but don't ignore it as a factor.... Clock speed depends on expected worst case simultaneity. Pending # of buttons: between simultaneity and debounce, it isn't trivial... Good Hunting... <<<)))
 
Status
Not open for further replies.

Latest threads

Back
Top