You're currently on: Catalog » Guides » How a 74HC138 selects a memory chip
The CPU gives every byte an address. The 74HC138 turns part of that address into a signal saying which chip is allowed to answer. Let’s build that idea one step at a time.
RAM, ROM and I/O chips share the CPU’s eight data wires. During a read, one chip must put a value on those wires while the others remain silent. Each chip therefore has a chip-enable or chip-select input, often written /CE or /CS. “Selecting a device” means activating that input for the address range assigned to it. This is separate from selecting an individual byte within that chip.
/CE
/CS
The CPU has address wires A0 through A15. Lower wires can choose a byte inside a memory chip. Higher wires can choose which chip is enabled. A 74HC138 reads three binary inputs, A, B and C, and activates one of eight outputs. The slash on an output name means that low selects it.
For a straightforward always-enabled example, connect pin 6 (G1) high and pins 4 and 5 (/G2A, /G2B) low. The chip needs power on pin 16 and ground on pin 8. Put a 0.1 µF bypass capacitor close to those supply pins. These are conceptual connections, not a complete board schematic: check logic-level compatibility and timing before building.
G1
/G2A
/G2B
Connect CPU A13 to decoder input A (pin 1), A14 to B (pin 2), and A15 to C (pin 3). Why those lines? The lower 13 bits, A0–A12, can count from 0 to 8191: 8 KB of positions inside one window. The next three bits identify which of the eight windows the CPU is visiting.
A15 A14 A13 = 000. Output pin 15 goes low.
001. Output pin 14 goes low.
010. Output pin 13 goes low.
011. Output pin 12 goes low.
100. Output pin 11 goes low.
101. Output pin 10 goes low.
110. Output pin 9 goes low.
111. Output pin 7 goes low. This region includes the reset vector.
$E123
111
/Y7
$0123
Next, see how an 74HC245 controls the direction of an eight-bit data bus after an address has selected the device.
The shop lists an MC74HC138AD in SOIC-16 surface-mount packaging. It will not plug directly into a solderless breadboard; use an adapter or find a through-hole part if that is what your build needs.
Browse Retro ICs
We use cookies to provide you with the best possible experience. They also allow us to analyze user behavior in order to constantly improve the website for you.