0
\$\begingroup\$

I have read this question and the answers that follow on the electrical stack exchange but I still face a difficulty in understanding the practical difference between high-Z state and 0 state. It is commonly used in hardware description languages. I know that the high-Z state is when the connection is removed. But I want to understand the physical difference.

My question is best understood with the help of this thought experiment:

Consider only the output terminal of a tri-state buffer is visible and available to me, and a demon (like the one in Maxwell's thought experiment) is applying 0 or 1 to the 2 inputs of the tri-state buffer. I have to detect when the terminal is tri-stated. I have only an LED and a NOT gate with me and both are of the same logic family as the tri-state buffer. I can ground my circuit.

First, I connect the LED to the output terminal of the buffer. I know that the LED will remain off when the output of the buffer is 0 and when the output of the buffer is tri-stated.

So instead, I'll place a NOT gate between the output of the tri-state buffer and the LED. So will the LED will be off only when a logic 1 is on the output of the tri-state buffer?

If so, is it possible to identify whether a terminal is tri-stated or 0 without measuring the resistance of the terminal?

\$\endgroup\$
3
  • 3
    \$\begingroup\$ Now do the same thing, but instead of connecting the LED between the output and ground, connect the LED to Vcc and the output. It will still be off. \$\endgroup\$ Commented Jul 8, 2020 at 11:02
  • 3
    \$\begingroup\$ @ShashankVM You don't need an extra power supply, you use the +ve supply to the logic. \$\endgroup\$
    – Neil_UK
    Commented Jul 8, 2020 at 11:12
  • 1
    \$\begingroup\$ logic 1 and logic zero are different from high-Z when cosidering what it will do to the next stage of logic. See this recent answer on why pins should not be left floating. electronics.stackexchange.com/a/508339/238590 When you stop pushing the button, the MCU input is disconnected from 4V supply, but since there is nothing to discharge that 4V from the parasitic capacitance, it will stay at 4V forever, and will never read as logic 0, no matter how long you wait. \$\endgroup\$
    – AJN
    Commented Jul 8, 2020 at 11:13

4 Answers 4

5
\$\begingroup\$

Here's a possible implementation of a tri-state output.

enter image description here

If only the top FET is ON then the output is logic level 1.

If only the bottom FET is ON then the output is logic level 0.

If both FETs are OFF then the output is high-impedance, which means this particular output pin doesn't do anything to the actual voltage on the wire. If it is not driven to a valid logic level by some other component, like a pull resistor or another non-tristated output wired in parallel, then it has no defined logic level. Usually it is noted as logic level "X" which means "undefined". Actual voltage will be "whatever" depending on circuit parasitics like leakage or remaining charge in chip capacitance, and if this is fed to the input of another chip it may be interpreted as any random level, or cause excessive current draw if voltage is close to midsupply and both input FETs conduct.

If so, is it possible to identify whether a terminal is tri-stated or 0 without measuring the resistance of the terminal?

No.

You can use LEDs as you say in the question, here are examples:

enter image description here

On the left, if the gate outputs 1 or 0, only one LED will light up. If it is High-Z then both LEDs will light up if supply voltage is enough for 2 series LEDs, or no LEDs will light up if supply voltage is too low.

On the right, if the gate outputs 0 the LED will not light, if it outputs 1 it will glow strongly, and if it is High-Z the LED is connected to the supply via a high value resistor so it will glow weakly.

\$\endgroup\$
3
\$\begingroup\$

Your thought experiment needs more definition of where the LED is connected, what a 'not' gate is, and what 'measuring' means.

If the LED goes to GND, it will be off for tristate, and off for a driven '0'.
If the LED goes to VCC, it will be off for tristate, and on for a driven '0'.

If the NOT gate sources any current to its input pin (as does a TTL NOT gate, or an ECL NOT gate, whereas a CMOS NOT gate is pretty much open circuit), then when driven with a tristate pin, the output will go to a solid and reliable output level, depending on the direction of input bias current. With a CMOS gate, tristate input will mean the output of a NOT gate will not be predictable, but it will tend to keep the last state, due to the input capacitance maintaining the input voltage, in the absence of any discharge paths to GND or VCC.

What's a measurement of input resistance? ICs often use a 'weak pullup' or a 'weak pulldown', or even a 'weak pull to the middle' to determine whether the pin is connected to anything. If it's at the voltage that it's being 'weakly pulled to', then the decision is that the pin is not being driven, or is being driven by a high impedance three-state.

\$\endgroup\$
2
\$\begingroup\$

High-Z is an invalid logic level. It represents no connection to the circuit. It's the same as if the chip wasn't there at all.

If you measure the voltage, you might get somewhere between a 0 and a 1 depending on stray capacitance, leakage currents, and so on. Some types of logic gates will leak a small amount of current out of their inputs which will make the line 1. Some types consume a small amount on their inputs which will make the line 0. Some types consume no current and the voltage will change if you put your hand near it. (I'm not kidding, this really happens)

It is possible to detect a disconnected signal. Multimeters can measure resistance, and so can you. You could connect the line to high through a resistor, and see if it goes high, and then to low through a resistor, and see if it goes low. Or you could connect it to a different voltage (like halfway between high and low) through a resistor and see if it goes to that voltage. You don't want to feed the halfway voltage to inputs of logic gates though; they won't handle it correctly. It will take more circuitry than just using two separate binary signals to transfer 3 states.

The main reason that Hi-Z is used is when you want to connect a different output to the same wire. Like in a microcontroller - if you set a pin to input mode, the output part of the pin circuit goes to Hi-Z. Otherwise you could only input what it was outputting and you couldn't connect it to another output. This can also be used in some circuits to save power. They are also used in busses to ensure that only one device tries to talk on the bus at a time.

\$\endgroup\$
5
  • \$\begingroup\$ I think it is better to say that high impedance might be an invalid logic level. The logic level of a high-z is unknown and might possibly be a valid 0 or 1. The distinction is important when you start to create resolution functions for multiple drivers of the same node. \$\endgroup\$ Commented Jul 8, 2020 at 17:29
  • \$\begingroup\$ @ElliotAlderson Perhaps it would be even better to say it's not a logic level? \$\endgroup\$ Commented Jul 8, 2020 at 18:12
  • \$\begingroup\$ No, the point is that the voltage might be a perfectly valid logic level. The "high-Z" tells us about how much current we get from the pin but says nothing about the voltage of the pin. \$\endgroup\$ Commented Jul 8, 2020 at 18:15
  • \$\begingroup\$ @elliotalderson right, so it's not a logic level, just like "purple" isn't. The "purple" may tell us what wavelengths of light are reflected from the pin but it says nothing about the voltage. \$\endgroup\$ Commented Jul 8, 2020 at 18:16
  • \$\begingroup\$ The wording is tricky here. If you say that "high-Z is not a logic level" someone might read that as "a high-Z pin is not at a valid logic level". I think it is much better to say explicitly that the logic level of a high-Z pin is unknown. \$\endgroup\$ Commented Jul 8, 2020 at 18:22
1
\$\begingroup\$

Think about an on off switch. In one position it connects the output wire to ground. This is equivalent of the output driver driving the output to low, so this is a low impedance state. In the other position, it disconnects it from ground. This is equivalent of the output driver driving neither low or high, so the output is not connected anywhere. That is the high impedance state.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.