Address decoder lab with a 74HC138
Build it step by step
0 of 8 donePlace the chip
Straddle the breadboard centre gap.
Wire power
Pin 16 to 5V and pin 8 to GND.
Wire the enables
Pins 4 and 5 to GND, pin 6 to 5V.
Wire three switches
Each with a 10 kilohm pull-up to 5V, switch to GND, to pins 1, 2 and 3.
Wire the eight LEDs
Anode to 5V through 1 kilohm, cathode to Y0 to Y7.
Leave all switches open
The pull-ups read 111, so the Y7 LED lights.
Flip the switches one by one
A different LED lights for each of the eight combinations.
Pull pin 6 low
All LEDs go out, the decoder is disabled.
How do you build an address decoder lab with a 74HC138?
Use a 3-to-8 decoder to select one of eight LEDs and learn how address decoding picks a memory chip or device. You need 74HC138 3-to-8 decoder, DIP switch 8-position, LED 5 mm red × 8, Resistor 1 kΩ × 8, Resistor 10 kΩ × 3, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm). It takes 8 steps and about 120 minutes.
- Level
- Beginner
- Time
- About 120 min
- Parts
- 7
Parts list
- Integrated CircuitsBuy
- SwitchesBuy
- SemiconductorsBuyLED 5 mm red × 8
- PassivesBuyResistor 1 kΩ × 8
- PassivesBuyResistor 10 kΩ × 3
- PrototypingBuy
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Chip pin 16 (VCC) | 5V | Power |
| Chip pin 8 (GND) | GND | Ground |
| Address switches | Pins 1, 2 and 3 (A, B, C) | Each pulled up with 10 kilohm, switch to GND |
| Enable pins 4 and 5 | GND | Active-low enables, always on |
| Enable pin 6 | 5V | Active-high enable, always on |
| Outputs Y0 to Y7 (pins 15 to 9 and 7) | LED cathodes | Each LED has its anode to 5V through 1 kilohm |
Code
A 74HC138 reads three address bits and pulls exactly one of its eight outputs low. This is how a small computer chooses which memory or device to talk to: each output is wired to the chip-select pin of one device, and the address bits decide which one wakes up. The outputs are active low, so each LED is wired from 5 V through a resistor to its output pin, and lights when that pin goes low. The three enable pins let you switch the whole chip on or off, and they make it possible to chain two decoders: use the top address bit to enable one chip or the other and you get sixteen outputs. The three input switches use pull-up resistors, so an open switch reads a 1 and a closed switch to ground reads a 0. The 1 kilohm resistors keep the current well within what the HC chip's outputs can sink. Unused inputs on CMOS chips must never float; every input here is tied high or low.
This build needs no code. Everything is done with the chip and switches. Truth table (switch ON = connected to GND = 0): C B A -> output that goes LOW (its LED lights) 0 0 0 -> Y0 0 0 1 -> Y1 0 1 0 -> Y2 0 1 1 -> Y3 1 0 0 -> Y4 1 0 1 -> Y5 1 1 0 -> Y6 1 1 1 -> Y7 Enable pins: G1 (pin 6) must be HIGH, G2A (pin 4) and G2B (pin 5) must be LOW. If any enable is wrong, all eight outputs stay HIGH and every LED is off.
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| All three switches closed (000) | Y0 lit |
| Switches set to 101 | Y5 lit |
| All switches open (111) | Y7 lit |
| Enable pin 6 to GND | All LEDs off |
| Two enables not grounded | All LEDs off |
If it does not work
No LED lights
Check the three enable pins and the power pins.
Two LEDs light
One input is floating, add or check its pull-up.
Wrong LED for a code
Remember on means 0 and pins are A=1, B=2, C=3.
LED very dim
Check the 1 kilohm values and the LED direction.
Chip gets warm
Check for a short on the outputs and the power rails.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the address decoder lab with a 74HC138?
74HC138 3-to-8 decoder, DIP switch 8-position, LED 5 mm red × 8, Resistor 1 kΩ × 8, Resistor 10 kΩ × 3, Breadboard 830 Tie Points and Jumper wires male to male (40 pcs, 20 cm).
How long does the address decoder lab with a 74HC138 take to build?
About 120 minutes for a beginner maker, in 8 steps.
How do I know the address decoder lab with a 74HC138 works?
All three switches closed (000): Y0 lit. Switches set to 101: Y5 lit. All switches open (111): Y7 lit.
No LED lights: what should I check?
Check the three enable pins and the power pins.
Two LEDs light: what should I check?
One input is floating, add or check its pull-up.
Wrong LED for a code: what should I check?
Remember on means 0 and pins are A=1, B=2, C=3.
LED very dim: what should I check?
Check the 1 kilohm values and the LED direction.
