← All parts
74HC138 3-to-8 Decoder
SN74HC138
Texas Instrumentsic logic
The 74HC138 is a high-speed CMOS 3-to-8 line decoder/demultiplexer with active-low outputs. Three select inputs and three enable inputs choose one of eight outputs, easing memory decoding and cascading.
In stock
Specifications
10- Logic Function
- 3-to-8 line decoder/demultiplexer
- Operating Voltage
- 2 to 6 V
- Operating Temperature Range
- -40 to 85 C
- Supply Current Max
- 80 uA
- Output Drive Current
- 4 mA
- Input Current Max
- 1 uA
- Propagation Delay Typical
- 15 ns
- Input Capacitance Max
- 10 pF
- Output Current Continuous
- 25 mA
- Package Types
- SOIC-16, SSOP-16, PDIP-16, SO-16, TSSOP-16, CDIP-16, CFP-16, LCCC-20
Pinout
16| Pin | Name | Functions | Notes |
|---|---|---|---|
| 1 | A | GPIO | Select input A (LSB) |
| 2 | B | GPIO | Select input B |
| 3 | C | GPIO | Select input C (MSB) |
| 4 | G2A | GPIO | Active-low enable A |
| 5 | G2B | GPIO | Active-low enable B |
| 6 | G1 | GPIO | Active-high enable |
| 7 | Y7 | GPIO | Output 7 (MSB) |
| 8 | GND | GND | Ground |
| 9 | Y6 | GPIO | Output 6 |
| 10 | Y5 | GPIO | Output 5 |
| 11 | Y4 | GPIO | Output 4 |
| 12 | Y3 | GPIO | Output 3 |
| 13 | Y2 | GPIO | Output 2 |
| 14 | Y1 | GPIO | Output 1 |
| 15 | Y0 | GPIO | Output 0 (LSB) |
| 16 | VCC | POWER | Supply voltage |
Interactive pinout
Highlight:
SN74HC138
Click a pin to copy its name · tap a tag above to spotlight a bus.
Starter code
Community starter examples — minimal, unofficial, and provided to get you wiring fast. Verify against the manufacturer datasheet before relying on them.
Arduino (C++)
arduino
// 74HC138 3-to-8 line decoder — community starter example
// A/B/C select which ONE of Y0..Y7 goes LOW (active-low outputs).
#if defined(ESP32)
#define A_PIN 25
#define B_PIN 26
#define C_PIN 27
#else
#define A_PIN 2
#define B_PIN 3
#define C_PIN 4
#endif
void selectOutput(uint8_t n) { // 0..7 -> Yn goes LOW
digitalWrite(A_PIN, n & 1);
digitalWrite(B_PIN, (n >> 1) & 1);
digitalWrite(C_PIN, (n >> 2) & 1);
}
void setup() {
pinMode(A_PIN, OUTPUT); pinMode(B_PIN, OUTPUT); pinMode(C_PIN, OUTPUT);
}
void loop() {
for (uint8_t n = 0; n < 8; n++) { selectOutput(n); delay(200); }
}MicroPython
python
# 74HC138 3-to-8 decoder (ESP32) — community starter example
from machine import Pin
import time
a = Pin(25, Pin.OUT); b = Pin(26, Pin.OUT); c = Pin(27, Pin.OUT)
def select(n): # Yn goes LOW
a.value(n & 1); b.value((n >> 1) & 1); c.value((n >> 2) & 1)
while True:
for n in range(8):
select(n); time.sleep_ms(200)Wiring
| Pin | Arduino Uno R3 | ESP32 DevKitC (WROOM-32) | Notes |
|---|---|---|---|
| VCC | +5V | 3V3 | 2-6 V |
| GND | GND | GND | |
| A | D2 | GPIO25 | Select bit 0 |
| B | D3 | GPIO26 | Select bit 1 |
| C | D4 | GPIO27 | Select bit 2 |
| G1 | +5V | 3V3 | Enable: tie HIGH |
| G2A/G2B | GND | GND | Enable: tie LOW |
| Y0..Y7 | - | - | Selected output goes LOW (active-low) |
Typical uses
- Selecting 1 of 8 lines (chip-select, mux address)
- Driving common-anode displays / banks