Close

Ternary Prequel

A project log for Tern - Ternary Logic Circuits

A series of ternary logic gates and higher level components implemented in the real world.

mechanical-advantageMechanical Advantage 06/14/2015 at 05:460 Comments

Before I begin, this first log will cover what I tried earlier, why that failed, and how that led me to choose comparators as the tool-of-choice.

Initially I planned on using transistors, but the parts count would be far too high. Two factors play into this. First, that ternary gates are more complicated (in most cases) than binary gates, thus requiring more transistors. Second, that the binary gate examples you usually see on the internet are rather naive. You might see an example showing only two FETs being used to implement a binary inverter, but if you check the datasheet for an actual part, you'll probably see two transistors, a resistor, and five diodes per gate (actual example: CD4049B). That's what it takes to make a reliable gate. In addition to all that, transistors have a property wherein they only switch if the voltage applied is greater than their threshold voltage. The threshold voltage is determined by the chemistry of the silicon itself and cannot be altered. Unfortunately transistors nowadays are mostly built with threshold voltages that coincide with binary voltage levels. You almost can't find any with distinctly different thresholds unless you go to expensive power MOSFETS intended for switching high current loads or automotive transistors. In both cases the threshold voltages are way higher than the usual binary digital threshold voltages so your circuit would have all sorts of voltages, and all your components would have to be capable of handling the highest one used. I'm sure if someone searched long enough (or just plain knew more about it than I do) they could find appropriate parts, but it would still take up too much board space.

Next I looked at Op Amps because they do the job of comparing one voltage to another and producing an output based on the difference. That fits nicely with what I'm trying to accomplish; detect the value of different voltage levels and behave accordingly. However, Op Amps are not ideal for this purpose because each amplifier needs to have it's feedback, hysteresis, and sometimes output voltage controlled with external resistors. This adds complication and means that one op amp might not behave exactly the same as another. Again, I don't want to spend any more time than necessary debugging analog problems.

Finally I settled on Comparators. They are basically specialized Op Amps with built-in hysteresis that don't require external feedback. This cuts out two resistors right away and ensures consistent behaviour. However, most comparators have open drain outputs, which does require a resistor. The upside of this is flexibility. If a single device has four comparators in it, each comparator can output a different voltage level, not just the VCC level. This can dramatically reduce the parts count for more complex gates. Unfortunately, comparators suffer from a condition that doesn't affect Op Amps nearly as much. This is limits to common mode input voltage. Your common mode input voltage is the sum of the voltages applied to each input divided by 2. If the resulting number is too close to VCC, then the comparator could do just about anything. If you are comparing 5V against 4V (common mode = 4.5V) and the device is powered by 5V with a common mode limit of VCC minus 1.5V (3.5V in this example) then the output can't be relied on to be correct.

For this reason, I have decided to use a dual-supply power system. That means a +5V rail, a -5V rail, and a common ground. Most comparators are okay with using +/- instead of +/GND so it isn't a problem, it's just a little weird for those of us who don't have a lot of experience with analog components. The benefit of using a dual-supply is that you are usually comparing a positive voltage against a negative voltage so the common mode is pretty close to 0V and the comparator won't do weird things.

Discussions