ABC of Electronics cosycom.com
LESSON 35

Shift Registers

A small chip that turns a handful of pins into many more, by loading output bits one at a time instead of all at once.

A microcontroller only has a limited number of GPIO pins, and it's easy to run out once a project needs to drive many individual LEDs or read many buttons. A shift register is a simple, cheap IC that expands a small number of pins into many more outputs (or inputs), by trading speed for pin count.

A common example is the 74HC595, an 8-bit "serial-in, parallel-out" shift register. Instead of wiring 8 separate output pins from your microcontroller, you use just 3: a data pin, a clock pin, and a latch pin. The microcontroller sends one bit of data at a time on the data pin, pulsing the clock pin after each bit — this "shifts" that bit into an internal 8-bit storage register inside the chip, one position at a time. Once all 8 bits have been shifted in, pulsing the latch pin makes all 8 of the chip's output pins update simultaneously to match what was just shifted in.

The name describes the mechanism exactly: bits shift, one place at a time, through a register (a small internal memory), like a line of people each passing a bucket to the next. Multiple shift registers can even be chained together — the last bit shifted out of one feeds directly into the next — letting a handful of microcontroller pins ultimately control dozens or hundreds of outputs.

The tradeoff is speed: shifting 8 bits in one at a time is much slower than setting 8 pins directly and simultaneously. For things like static LED displays or infrequently-updated indicators, that's a completely worthwhile trade for the pins saved.

Bits shifting through Each clock pulse moves every bit one position to the right, until the whole register is loaded and latched to the outputs.
KEY TAKEAWAY
A shift register loads several output bits in one at a time over just 2-3 microcontroller pins, then updates them all at once — trading speed for a big reduction in pins used.