[sdiy] Question about tri-state buffers and encoders

brianw brianw at audiobanshee.com
Tue Sep 12 03:41:27 CEST 2023



On Sep 10, 2023, at 3:16 PM, David G Dixon wrote:
> Thanks for the responses.
>  
> Brian, I actually left the three highest-priority inputs unconnected.  I only needed 0 through 12 for my circuit, so I left 13, 14 and 15 unconnected.  As I said, grounding them fixed the circuit, and it works perfectly now, even though many of the buffer output busses are hi-Z during operation.

If you shift all your active inputs to be 3 through 15 - leaving 0, 1, and 2 unconnected - then those unused inputs might actually work fine whether they're grounded or pulled up.

I doubt you'll need to actually connect unused inputs to tri-state, but if you do, and you follow Jay's advice to use pull-ups instead of pull-downs, then the lowest-priority inputs won't cause any problems even when they're high.


> Also, I needed tri-state buffers because many of the encoder inputs are connected to multiple buffers.

Okay, this is really begging for a schematic, or at least a very high-level block diagram. If many of the encoder inputs need to be connected to multiple buffers, then I have a couple of important questions:

1) How do you ensure that it's impossible for more than one (tri-state) buffer to be active at the same time? The tri-state buffers will eventually burn each other out if they're fighting to drive even slightly different voltages (i.e. it doesn't have to be as bad as one driving low and the other driving high - they could both drive high but have a slightly different Vcc).

2) How do you ensure that the output of the priority encoder is ignored during transitions from one buffer activation to the next? i.e. If any one of the sixteen encoder inputs is tri-state hi-Z, then the output of the encoder is unusable.

The answers to the above question define your bus operations. You should be able to design for Jay's bus pull-ups and end up with a circuit that behaves correctly all the time. ... at least if you're actually designing a real bus and not something different.


> There is no schematic, but basically it is Scale Logic for a quantizer.  The quantizer circuit sends a binary number to a decoder (CD4514) which generates an integer.  This integer gets sent to buffers.  The buffers are hard wired to convert chromatic notes to diatonic notes.  For example, for the Major scale, there are buffers connecting 1 to 2, 2 to 4, 3 to 5, 4 to 7, 5 to 9, and 6 to 11.  (Note: 0 is hardwired to 0, as the tonic note is always 0, so no logic is required there).  Hence, when the Major scale is selected, only the 2, 4, 5, 7, 9 and 11 busses will be active (as well as the 0 input, which comes directly from the 4514).  The 1, 3, 6, 8, 10 and 12 busses will all be hi-Z.  These busses are hardwired to the encoder circuit, which converts them back to binary and sends them to a DAC.

A "bus" is a collection of signals as a group. And, as a group, all signals on a bus should be active at the same time, or hi-Z at the same time (within the propagation delay time of the individual gates, that is). Sounds like you have 13 digital bits feeding a pair of priority encoders that can handle 16 values, 0 through 15, but you only need 13 of those to be valid and the rest should be hard-coded. In such a situation, all of the inputs to the encoder would be considered a single bus (whether it's a 13-bit bus or a 16-bit bus), and that's not even considering that these encoders are not designed for having their inputs connected to a bus.

Just to be clear, the CD4532 is not designed to have some inputs driven, and some input floating, and you can't expect the chip to then sort through that combination to find the highest priority input. All inputs have to be driven to one of two states - high or low - and never be in hi-Z.

Sounds like what you might need is a set of OR gates or AND gates to combine multiple buffers into a single input. You could even get by with wire-OR (open collector) or wire-AND, which is sorta like tri-state, except that there are only two states. Using tri-state to combine multiple signals to a single pin is not quite right because the floating state is indeterminate, and your circuit doesn't sound like something where you want indeterminate results.

In any case, a block diagram would help us all to understand exactly what you're doing, and point you in the right direction so this thing actually uses the CMOS logic chips the way they're designed to be used.


> As I mentioned, the circuit now works perfectly with only the 13, 14 and 15 inputs grounded, but I have redesigned one of the PCBs to add 10k pulldown resistors to all 12 busses.  Hence, when (if) I build this module again, I will do it right.

If your circuit works with pull-down resistors, then I highly expect that what you really need is open-emitter drivers connected in a wire-OR configuration.

It's probably inconvenient to find open-emitter drivers, but it's not that difficult to convert to pull-up resistors and open-collector drivers in a wire-AND configuration. You may just need some inverters (gates or transistor or a CMOS hex inverter).

There are probably ancient hack circuits out there where someone got a bunch of tri-state buffers and coaxed them into operating like open-collector drivers, but that's not a good place to start with a new design.

> I'm going to make a brief YouTube video demonstrating this module, probably later today, so look out for that if you are interested.  It will be called Sketchy Labs New Folding Quantizer Part 2 (Part 1 was about the prototype I built for the other guy, that miraculously worked even with those three 4532 inputs disconnected).

Lots of circuits work just find until you wave your hands over them and cause an electromagnetic field variation that flips floating bits just the wrong way. ... or until the little errors in the design end up overheating the CMOS gates and you have dead chips.

e.g. I've designed with many MCU chips that allow you to leave the Reset input pin floating, because they have internal pull-ups to keep the active low Reset from triggering falsely. I designed with a Microchip PIC chip that didn't have an internal pull-up, or if it had one then it wasn't beefy enough. This Reset pin was connected to a header that acted like an antenna, so it could easily pick up EMI. The darn boards worked just fine for me in my home studio, and I made several of them that all worked, but as soon as I sent prototypes to the client, they told me that the board would mysteriously glitch. I eventually noticed that the Reset pin needed a pull-up, and that solved it. Without the pull-up, the whole thing was vulnerable to the slightest hand wave gesture. Moral of the story: "Works for me!" is not good enough.

> Cheers,
> Dave




More information about the Synth-diy mailing list