# Tri-state output to three analogue levels?

Is there a circuit which can transform a tri-state (low, high-Z, high) output to three voltage levels?

Ideally, the circuit will use only passives and diodes.

Would a simple voltage divider across the pin do the job?

             Vdd
|
R
|
tri-state-----+-------out
|
R
|
Vss

• wow, that sounds pretty trippy. Is there some other part of the system that we can work with to get you the same results? Can you expand on the rest of what you are working with, maybe with a schematic? There may be a simpler way. Dec 19, 2014 at 9:36
• If you are driving a load, you may want to use an op-amp buffer after the "out" signal. Dec 19, 2014 at 9:49
• A transistor doesn't use the voltage levels properly, how do you expect that to work? An op-amp set as a simple "voltage buffer" will mean that you can connect an LED to the output of the op-amp and it will reflect the voltage level on the input, as the output, but also be able to drive current properly. voltage dividers cannot drive current properly, through an LED, and retain their levels. Dec 19, 2014 at 9:56
• If you want to dim an LED, you can do that without any fancy circuitry - use PWM to do it! Dec 19, 2014 at 10:10
• @NickJohnson: PWM without an analog reconstruction filter doesn't dim an LED... it causes a reduction in average light output, which appears dimmed to the human eye, but that's due to persistence of vision. Other light sensors typically don't have persistence of vision. Dec 19, 2014 at 21:25

Yes, you can connect a voltage divider to the output pin, say, using equal resistors. That'll give you half the supply voltage when the output is HIGH-Z, and the normal HIGH and LOW when the output is in those states. Two resistors, no diodes needed.

A simple potential divider will work, and is commonly used for this.

Vhigh, Vlow, Vdd/2 levels for 1,0,Z respectively.

Remember the 0/1 to Z transition will be relatively slow because it is not actively driven (just the RC time constant); or in other words, the Z state has a low drive capability (5k$\Omega$ source resistance).

simulate this circuit – Schematic created using CircuitLab

• Note that the drive power of the Z state will be much lower, too, since it has the equivalent of 5k series resistance rather than the much lower resistance of the gate driver. Dec 19, 2014 at 10:10
• Adding a third resistor in series with the 3-state output will allow further control over the output behavior; adding a fourth resistor directly from the output to either VDD or VSS will make it possible to establish any three desired voltage levels. Dec 19, 2014 at 19:01

I use the same arrangement in the laboratory of digital electronics to demonstrate to my students the idea of the tri-state output (of the unidirectional buffer 74LS244). To directly visualize the output state, we connect two LEDs in series to each resistor. Thus, when the output is OFF (HI), both the LEDs light. At low or high output voltage, one of them is shunted by the internal transistor, and extinguishes. We also connect a LED network (two LEDs - red and green, in parallel) between the outputs of the chip and voltage divider. Also, we replace the voltage divider by a potentiometer and move its slider; in HI state, it produces a voltage varying between the rails.

You can replace the voltage divider by a resistor connected between the output and some voltage between the rails (usually, 1/2Vcc). In the laboratory, we connect it to the output of a pulse generator (when the output is in HI state, we see the pulsess; otherwise we see high or low voltage depending on the input signal).

It's possible to have low/float/high output any three voltages between the rails by using the four resistor circuit shown below (note that only one of the R4 resistors will be needed; which one will depend upon the desired output voltage when the output is floating). The circuit below will output 1/2/3 volts when the output is low/float/high.

simulate this circuit – Schematic created using CircuitLab

Assuming VS is the supply/output high voltage, and the desired top/middle/bottom voltages are VT, VM, and VB respectively, assign values to R1 and R2 such that R1/R2=VB/(VS-VT) [in this example, 10k/20k = 1V/(5V-3V)]. Resistors may be scaled up and down together as convenient. Next, assign R3 so that VB/R1+VB/R3 = (VS-VB)/R2 [in this example, 1V/10K + 1V/10K = (5V-1V)/20K.] That will make the output yield the correct voltages for 'high' and 'low' cases, but not necessarily for the 'float' case.

If the 'float' voltages is too low, add R4a to raise it; if it's too high, add R4b to lower it. In this example, it's necessary to raise the voltage. When the output is at the correct voltage, 0.2mA will flow through R1 and 0.15mA through R2. That means 0.05mA must flow through the series string of R4a+R3 which has 3 volts across it, so the total resistance of that string must be 60K; R4a must thus be 50K.

• An interesting idea... like a bridge circuit where we short the upper or lower legs of the left half-bridge (R4a-R4b) and observe the output of the right half-bridge (R2-R1)... Actually, the voltage divider R4a-R4b acts only when the output is in HI state; otherwise, it is overrided by the closed transistor. But still there is something strange in this connection of a high-resistive circuit after a powerful CMOS stage... Dec 20, 2014 at 11:58
• The R4a/R4b isn't intended as a "voltage divider"; the idea is that only one or the other would be populated; the 1G resistor is intended to represent an open-circuit. Dec 21, 2014 at 22:54