26
\$\begingroup\$

What does it mean to "tristate a pin" on a CMOS microcontroller?

\$\endgroup\$
34
\$\begingroup\$

"Tristate" means a state of high impedance. A pin can either pull to 0 V (sinking current, generally), pull to 5 V (sourcing current, generally), or become high impedance, like an input.

The idea is that if a pin is in high impedance state, it can be pulled to high or low by an external device without much current flow. You see this kind of thing on bidirectional serial lines, where sometimes a pin is an output and sometimes an input. When it's an input, it's "tristated," allowing the external chip to control its logic level.

Does that make sense in your situation?

\$\endgroup\$
  • \$\begingroup\$ Excellent. Glad to be of service. \$\endgroup\$ – pingswept Apr 29 '10 at 19:52
  • \$\begingroup\$ Not actually the correct answer, see below... \$\endgroup\$ – ttt May 5 '10 at 9:40
  • 5
    \$\begingroup\$ @Tim Ring: I think your answer is correct, but I'm not sure where you think I've gone wrong. I understand that "tristate" refers to the ability of a pin to be configurable into three states-- high, low, or high impedance. But in colloquial terms, when someone says "Tristate a pin," they mean to put it into high impedance state. \$\endgroup\$ – pingswept May 5 '10 at 14:38
  • 1
    \$\begingroup\$ I'm not disputing that the three states are high/low/highZ, I'm saying the bit where you say "if a pin is in high impedance state, it can be pulled to high or low by an external device without much current flow" This is really not the reason, you trisate a device, you deselect it to dis-connect it from the bus (by putting it in a hi-z state other devices can communcate with each other). \$\endgroup\$ – ttt May 7 '10 at 14:43
  • \$\begingroup\$ Ah, OK, I think I see what you mean. I agree that in the multidrop bus situation you describe, the point of the hi-Z state is not limiting current flow, but to allow another device to control the pin state, like you say. But there are times, other than the bus situation, where you might use a pin as an output some of the time, but use it as a high impedance input the rest of the time. \$\endgroup\$ – pingswept May 7 '10 at 16:05
15
\$\begingroup\$

The idea of tri-state is to allow multiple output devices to share a single bus. For example, multiple RAM/ROM chips can be connected to a data bus. Only the selected chip will have active outputs (high or low), the other chips (not selected) will have all their outputs set to the hi impedence state (the third state). For outputs devices to share a bus they must be tri-state capable (usually controlled by chip-enable/direction pins). For microprocessors, micro controllers their hi impendence state allows other devices to use the bus (common for smart I/O devices, DMA etc).

\$\endgroup\$
  • 1
    \$\begingroup\$ This answer adds is an explanation of why it is called "tri-state." (bc it is the "third state") and a bit of history. It is not more correct than the other answer. \$\endgroup\$ – Frederick Jan 20 '16 at 20:51
  • \$\begingroup\$ It's not just for devices to share a bus. I may want to selectively divide down a reference voltage. Using a high-z pin on the low side lets me drive it low and create a voltage divider or high impedance and allow the reference to pass thru. It's pretty much to allow you to selectively disconnect something from a circuit, whether it's digital or analog, communications or not. \$\endgroup\$ – iheanyi Feb 9 '18 at 16:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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