Tri-state Logic Input/Outputs

In digital electronics Tri-state logic (tristate, TRIS, three-state or 3-state) allows an input or output to assume a 1, 0, or a high impedance state (open).

image
One Buffer Tri-state Diagram

A tri-state input can detect whether the pin is a logic 1, 0, or not connected (open).
A tri-state output allows multiple circuits to share the same output line(s). If more than one device is electrically connected to another device, putting an output into the Hi-Z state is often used to prevent short circuits, such as when one device driving high (logic 1) against another device driving low (logic 0).

When outputs are tri-stated (in the Hi-Z state) their influence on the rest of the circuit is removed, and the circuit node will be “floating” if no other circuit element determines its state. Circuit designers will often use pull-up or pull-down resistors (usually within the range of 1–100 kΩ) to influence the circuit when the output is tri-stated.

*Tri-state logic can also reduce the number of wires needed to drive a set of LEDs (tri-state multiplexing or Charlieplexing).


There are four different types of Tri-state Buffer, one set whose output is enabled or disabled by an “Active-HIGH” control signal producing an inverted or non-inverted output, and another set whose buffer output is controlled by an “Active-LOW ” control signal producing an inverted or non-inverted output as shown below.

image

image

image

image


Tri-state is also very common in programming, and is known as “TRIS”. The TRIS register lets you choose whether the pin will be an input or an output and read or write to that pin. You must configure this register first before using the I/O pins. The typical default after a power-on reset is that they are all defined as inputs (read).

  • TRIS bit = 1 → pin is configured as an input
  • TRIS bit = 0 → pin is configured as an output
  • A handy way to remember this is that 1 looks like an “I” and 0 looks like a “O”
    image

The Tri-state Buffer is used in many electronic and microprocessor circuits as they allow multiple logic devices to be connected to the same wire or bus without damage or loss of data. For example, suppose we have a data line or data bus with some memory, peripherals, I/O or a CPU connected to it. Each of these devices is capable of sending or receiving data to each other onto this single data bus at the same time creating what is called a contention.

Contention occurs when multiple devices are connected together because some want to drive their output high and some low. If these devices start to send or receive data at the same time a short circuit may occur when one device outputs to the bus a logic “1”, the supply voltage, while another is set at logic level “0” or ground, resulting in a short circuit condition and possibly damage to the devices as well as loss of data.

Digital information is sent over these data buses or data highways either serially, one bit at a time, or it may be up to eight (or more) wires together in a parallel form such as in a microprocessor data bus allowing multiple tri-state buffers to be connected to the same data highway without damage or loss of data as shown.

image

Then, the Tri-state Buffer can be used to isolate devices and circuits from the data bus and one another. If the outputs of several Tri-state Buffers are electrically connected together Decoders are used to allow only one set of Tri-state Buffers to be active at any one time while the other devices are in their high impedance state. An example of Tri-state Buffers connected to a 4-wire data bus is shown below.

image

This basic example shows how a binary decoder can be used to control a number of tri-state buffers either individually or together in data sets. The decoder selects the appropriate output that corresponds to its binary input allowing only one set of data to pass either a logic “1” or logic “0” output state onto the bus. At this time all the other tri-state outputs connected to the same bus lines are disabled by being placed in their high impedance Hi-Z state.

Then data from data set “A” can only be transferred to the common bus when an active HIGH signal is applied to the tri-state buffers via the Enable line, ENA. At all other times it represents a high impedance condition effectively being isolated from the data bus.

Likewise, data set “B” only passes data to the bus when an enable signal is applied via ENB. A good example of tri-state buffers connected together to control data sets is the TTL 74244 Octal Buffer.

It is also possible to connect Tri-state Buffers “back-to-back” to produce what is called a Bi-directional Buffer circuit with one “active-high buffer” connected in parallel but in reverse with one “active-low buffer”.

Here, the “enable” control input acts more like a directional control signal causing the data to be both read “from” and transmitted “to” the same data bus wire. In this type of application a tri-state buffer with bi-directional switching capability such as the TTL 74245 can be used.

We have seen that a Tri-state buffer is a non-inverting device which gives an output (which is same as its input) only when the input to the Enable, ( EN ) pin is HIGH otherwise the output of the buffer goes into its high impedance, ( Hi-Z ) state. Tri-state outputs are used in many integrated circuits and digital systems and not just in digital tristate buffers.

Both digital buffers and tri-state buffers can be used to provide voltage or current amplification driving much high loads such as relays, lamps or power transistors than with conventional logic gates. But a buffer can also be used to provide electrical isolation between two or more circuits.

We have seen that a data bus can be created if several tristate devices are connected together and as long as only one is selected at any one time, there is no problem. Tri-state buses allow several digital devices to input and output data on the same data bus by using I/O signals and address decoding.

Tri-state Buffers are available in integrated form as quad, hex or octal buffer/drivers in both uni-directional and bi-directional forms.


Click here for Tri-State Output Buffers, Drivers, Receivers, Transceivers.


See also:
What is Charlieplexing, and what can I do with it?
Getting Started with the PIC32 and MPLAB X
ElectronicsTutorials - Digital Buffer Tutorial
Wikipedia - Three-state logic