[sdiy] Question about tri-state buffers and encoders

brianw brianw at audiobanshee.com
Sun Sep 10 23:35:23 CEST 2023

A) The CD4532 8-to-3 encoder is also known as an 8-bit Priority Encoder. It needs all inputs driven to a definitive High or Low in order to function properly, because the logic that it implements always considers all inputs. It's not designed for Hi-Z inputs. Technically, only the higher priority inputs are necessary. Which pins did you leave unconnected?

If you want to leave three "unconnected" then it might be possible if you ensure that these three are the lowest priority inputs. Then again, unconnected digital inputs often pick up noise, or cause unexpected currents to flow in the gates, so it's almost always best to connect unused inputs to the appropriate steady voltage, like ground.

B) Tri-state outputs are typically only useful on a bus, or anywhere that you need the option for more than one signal to drive the same input without conflict. A side effect of this is that tri-state outputs also require additional logic with careful timing so that there are never more than one output enabled at the same time, and also that the corresponding input being driven does not try to decode the voltage when nothing is driven (the hi-Z state).

Note that the Priority Encoder is not designed to operate on a bus where the inputs are invalid when switching between sources.

That said, it's common practice to design with tri-state chips when other options are not appropriate (or more expensive). In these cases, you need to design so that the tri-state chip is always driving its outputs, or you need pull-ups or pull-downs (depending upon the circuit) to ensure that hi-Z never occurs.

C) I'll just state that it doesn't seem correct to drive a priority encoder with tri-state outputs, unless you understand how you're abusing the technology and know how to work around the usual expectations for force things to work they way you want. There's nothing wrong with this kind of hackery - it's seen all the time in practical designs, especially in products from the 70s and 80s discrete logic days.

Brian Willoughby

On Sep 10, 2023, at 12:47 PM, David G Dixon via Synth-diy <synth-diy at synth-diy.org> wrote:
> Hello SDIY Team,
> Here's a question for the digitally inclined.  First a bit of context:
> I recently designed a circuit that uses CD4532 8-to-3 encoders (with a 4071 to make a 16-to-4 encoder, as per the datasheet).  The inputs are being driven by 74HC126 tri-state buffers.
> The circuit wasn't working -- all of the encoder outputs were staying high.  I had three of the encoder inputs unconnected.  I connected them to ground, and now the circuit works.
> However, I'm still a bit confused.  During normal operation, many of the tri-state buffers are in the Z state -- essentially disconnected from the output buss.  I have not put pull-down resistors on those outputs, so it seems to me that the ones that are off are looking like an open circuit to the encoder input.
> My first question is, why is the circuit working at all?  Is there something special about a tri-state outputs such that they don't require being pulled down to ground not to look like an open circuit to a CMOS input?
> My second question is, even though the circuit works with just the unconnected encoder inputs grounded, should I install pull-down resistors to ground onto all of the buffer outputs anyway, just to be safe?
> Addendum: I built one of these for a Wiggler, with a different layout but the same circuitry, and it worked fine, even though the three 4532 inputs were disconnected.  Is it going to stop working at some point?  The difference was that the connections were through wires for that build, whereas the connections were from a PCB on this current build.  Otherwise, the circuits themselves were identical.  I guess I just got lucky with that first build.
> Thanks in advance for any responses,
> Dave Dixon

More information about the Synth-diy mailing list