The goal now is to make the "register" from entry 9 "bus-friendly" by making the output "tri-state" using a tri-state buffer.
Tri-state outputs
Tri-state outputs (or three-state outputs) are a feature in digital electronics where an output pin can be in one of three states—not just the usual two (0 or 1). This is super useful when multiple devices share a common connection, like a data bus. Let’s break it down.
The Three States
- Logic 0 (Low): The output is actively driven to ground (~0V). Current flows out of the pin to ground.
- Logic 1 (High): The output is actively driven to the supply voltage (~5V for TTL/CMOS). Current flows into the pin from the supply.
- High-Impedance (Z): The output is effectively disconnected—it neither drives high nor low. It acts like an open switch, letting other devices control the line without interference.
- Normal Outputs: Only 0 or 1 (e.g., your 74HC74’s Q pins).
- Tri-State Outputs: 0, 1, or Z (e.g., 74LS173’s Q0–Q3 when controlled by G1/G2).
Why It’s Useful
Imagine a shared wire
- Without Tri-State: If two devices output at once (e.g., one says 0, another says 1), they fight—current flows between them, causing damage or garbage data.
- With Tri-State: Only one device is enabled at a time (outputs 0 or 1), while others are in Z-state (disconnected). No conflict!
So, here is how we can check if an output pin is 0, 1, or "Z":
Logic 0:
If an LED turns on when connected to the output, as in the picture, the output is low.
Logic 1:
If an LED turns on when connected to the output, as in the picture, the output is high.
High-Impedance (Z):
If the LED does not turn on in any of the cases, the output is in state Z.
In order to make the output of our register tri-state, we need four tri-state buffers between Q0–Q3 and the bus. This lets you enable/disable the register’s output.
Tri-state buffer
A single tri-state buffer is a simple yet powerful digital building block that lets you control whether a signal passes through to its output or gets disconnected, making it perfect for connecting devices to a shared bus—like your 4-bit register setup. It’s the key to the tri-state outputs we’ve been discussing, and understanding how it works at the gate and transistor level ties together a lot of what you’ve been exploring. Let’s dig into its operation.
What It Does
- Inputs:
- A (Data Input): The signal you want to pass (0 or 1).
- EN (Enable): Controls whether the output is active or high-impedance (Z).
- Output (Y):
- When enabled: Y = A (0 or 1).
- When disabled: Y = Z (high-impedance, disconnected).
Truth table:
A tri-state buffer cannot be constructed from basic gates. Instead, it is typically implemented with transistors. Like basic gates, I will not investigate the electronics behind it.
The 74LS126 has 4 tri-state buffers:
ACEL also has tri-state buffers.
Tri-state buffer in ACEL
The tri-state buffer in ACEL is called ThreeStateSwitch.
- The input is labeled D (for data)
- Enable is labeled E
- The output is labeled W (for write)
Here is how we can try it out. Add two buttons "D" and "E" to control the inputs. Here is the code, where D is connected to pin 2 and E to pin 3:
It is not possible to connect the output W to an Arduino pin using a "Connection", since W is tri-state (cannot make an output pin floating in Arduino). Hower, this is not really an issue, as the output of a tri state buffer will "go on a bus".
Instead, we can use the "print" functionality to investigate the tri-state buffer. Instead of clicking a button to get a print, we can add the line
in the setup section. We then automatically get a "print" each time anything happens.
You can check this out on Wokwi, project name "Tri state buffer".
The goal of the next entry is to complete the connection between the register and the bus adding 4 tri-state buffer.
No comments:
Post a Comment