You're currently on: Catalog » Guides » SN74LS259B adresserbar latch: otte udgange fra fem ledninger » Guides » SN74LS259B addressable latch: eight outputs from five lines
You want to switch eight LEDs, relays or enable lines, but your controller has only a handful of pins left. The SN74LS259B stores eight separate bits and lets you change any single one of them with five control lines, while the other seven stay exactly as they were. This guide explains the idea, walks through one complete write, and builds a test circuit with switches and LEDs.
A latch is a one-bit memory cell. While its enable signal is active, the output simply follows the data input. When enable is released, the output freezes at the last value and keeps it until the next write. The SN74LS259B contains eight such latches, Q0 to Q7, which all share one data input D.
So how do you choose which latch to write? With an address. The three select inputs S0, S1 and S2 form a 3-bit binary number from 0 to 7, and only the latch with that number listens to D. This is the same address-decoding principle that the 74HC138 address-decoding guide and the MC14515B decoder guide describe; here a memory cell sits behind every decoder output.
The combination of CLR and G gives four modes, taken from the function table in TI’s datasheet:
Say we want to set output Q5 to 1 without disturbing Q0–Q4, Q6 or Q7. Start with CLR HIGH and G HIGH (memory mode):
The datasheet gives the timing limits for the SN74LS259B: G must be LOW for at least 17 ns, the address must be stable at least 17 ns and D at least 20 ns before G rises, and the hold time after G rises is 0 ns. TI also advises that G be held HIGH while the address lines are changing; otherwise the latches you pass through on the way to the new address can briefly catch the data. With hand switches or a microcontroller these limits are easy to meet; they matter when you drive the chip from fast logic.
Why do the LEDs hang from +5 V? An LS-TTL output can sink 8 mA when LOW but is only specified to source 0.4 mA when HIGH. Wired this way, a red LED gets about 2.5–3 mA, which is well inside the limit, but the logic is reversed: an LED is lit when its bit is 0.
Contact bounce on WRITE is harmless here: each bounce simply writes the same D value to the same latch again. Do not change the switches while WRITE is held down, though, because the chip then behaves as a live demultiplexer.
Connect five 5 V GPIO pins to S0, S1, S2, D and G and keep CLR HIGH (or use a sixth pin for it). A write then is: set G HIGH, write the three address bits, write D, set G LOW, set G HIGH. A 3.3 V controller can usually drive the inputs, because an LS-TTL input recognises anything above 2 V as HIGH and below 0.8 V as LOW, but check that its pins can sink the 0.4 mA each LOW input draws. Do not feed the chip’s 5 V outputs back into a 3.3 V pin. If you need to read eight switches rather than drive eight loads, the MM74HC165 shift-register guide covers the opposite direction; for writing all eight bits at once, see the MC74HC173 register guide.
The stocked part is the Texas Instruments SN74LS259BN: an 8-bit addressable latch in Low-Power Schottky TTL in a 16-pin plastic DIP (TI package N), so it fits straight into a breadboard. Pinout, function table, timing and electrical limits in this guide come from TI datasheet SDLS086, whose package addendum lists SN74LS259BN as PDIP (N), 16 pins.
View the SN74LS259BN product page · SN74LS259B datasheet (Texas Instruments)
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.