Two registers, and the one thing worth understanding about them
- 192parts on the bench
- 25boards running now
- 1.00xreal time, on every board
The 74HC595 is the chip everyone reaches for when a microcontroller runs out of pins: three signal lines in, eight outputs out. Inside it are genuinely two separate eight-bit registers, and telling them apart is the entire trick to understanding the part.
The shift register is the one that moves. A rising edge on SHCP moves every bit one place along and drops whatever is on DS into the first stage. Do that eight times with a data bit on DS each time, and the shift register holds a full byte, one bit at a time, most significant or least significant first depending on the order you feed it.
The storage register, the latch, is the one you actually see. Q0 through Q7 only ever show what is in the latch, not what is in the shift register, and the latch only changes on a rising edge of STCP, which copies the whole shift register into it in one step. That is why, in the circuit above, the eight LEDs sit completely still while you shift bits in one at a time with the SHCP button, and only jump, all together, the instant you press STCP. That single jump is the entire reason a shift register can drive eight outputs cleanly from three pins: the outputs never show a partial, mid-shift byte.
Two more pins are worth knowing. MR, active low, clears the shift register alone and leaves the latch untouched, so the outputs keep showing the last latched byte until the next STCP edge; it is tied high here because nothing in this demonstration needs to clear early. OE, active low, three-states all eight outputs without touching either register, which is how you would dim a whole bank of LEDs or hand the bus to something else without losing the byte; it is tied low here so the outputs are always live. Every edge on this chip carries a real propagation delay, 15 nanoseconds by the datasheet, from SHCP or STCP to the outputs actually moving.
The slide switch in the circuit above is the data bit and the two buttons are SHCP and STCP, clocked by hand instead of by a microcontroller sixty times a second, specifically so the two-register behavior above is something you can watch happen one edge at a time rather than something a firmware sketch does too fast to see. The board pages run the same chip properly, driven by real firmware counting in binary across eight LEDs.
Build this for real
Open the editor, change a value and watch the number move with it. Nothing to install, and no account needed.