74HC595 shift register
Eight outputs from three pins. Shift a byte in and latch it.
- 16 pins
- In 1 project
- In 4 lessons
The 74HC595 shift register in brief
What it is, and where it sits on the bench.
The 74HC595 turns three signal pins into eight outputs, and the trick to understanding it is that there are genuinely two separate eight-bit registers inside. The shift register moves on every rising edge of SHCP, dropping whatever is on DS into the first stage and pushing everything else along by one; do that eight times and it holds a full byte. The storage register, the latch, is the one Q0 through Q7 actually show, and it only changes on a rising edge of STCP, which copies the shift register into it in one step. That is why the outputs sit completely still while a byte is clocked in and jump together only at the latch edge. MR clears the shift register alone, asynchronously, leaving the latch untouched; OE three-states all eight outputs without touching either register. Every edge carries the datasheet’s typical 15 nanosecond propagation delay before the pins actually move.
- Family
- Logic
- Pins
- 16
16 pins
Named as the editor names them, so a wire lands where you expect it.
Output9
- Q1
- Q2
- Q3
- Q4
- Q5
- Q6
- Q7
- Q7S
- Q0
Input or output2
- GND
- VCC
Input5
- MR
- SHCP
- STCP
- OE
- DS
How to use a 74HC595 shift register with an Arduino
The 74HC595 turns three Arduino pins into eight outputs. Data goes into DS one bit at a time, each rising edge on the shift clock SHCP moves it along, and a rising edge on the latch clock STCP copies all eight bits to Q0 to Q7 at once, so the outputs never flicker through the bits on their way in. shiftOut() does the shifting in one call.
Two pins catch everybody: MR (master reset, pin 10) must be tied to 5 V or the register keeps clearing itself, and OE (output enable, pin 13) must be tied to GND or the outputs float. In the circuit here they are, and eight LEDs hang off Q0 to Q7 through 220 ohm resistors.
Chain a second 74HC595 from Q7S (pin 9) into its DS and shift sixteen bits for sixteen outputs, still on three pins.
void show(uint8_t bits) {
shiftOut(4, 5, MSBFIRST, bits); // DS, SHCP
digitalWrite(6, HIGH); // STCP: copy to Q0..Q7
digitalWrite(6, LOW);
}What is true about the 74HC595 shift register, here
In its help article’s own words: what the simulation gets right, and where it stops.
74HC595: 8-bit shift register with output latch
The chip everyone reaches for when they run out of pins. Two registers inside it:
an eight-stage shift register clocked by SHCP, which moves everything along and
drops DS into stage 0 on a rising edge; and a storage register (the latch), which
is what Q0 to Q7 actually show and which only changes on a rising edge of STCP.
MR (active low) clears the shift register without touching the latch; OE
(active low) three-states the outputs without touching either register, so a
disabled chip still shifts and its last byte is unharmed underneath. Both registers
power up cleared. Propagation delay: 15 ns typical, STCP to Qn. See it in:
LED bar chaser.
Not modeled
One typical delay, and nothing around it. Each chip carries a single propagation
delay taken from its datasheet's typical column at VCC = 5 V, CL = 15 pF and
25 °C, and uses it for every path through the package. There is no minimum or maximum,
no spread between the gates in one chip, no rise or fall time, no output slew and no
dependence on supply voltage, load capacitance or temperature, all of which a real
74HC part has, and all of which a datasheet gives ranges for. On the 74HC595 the one
figure is the STCP-to-Qn number used for SHCP and MR to Q7S as well, which
the datasheet lists a nanosecond or two apart.
No setup, hold or pulse-width checks. The 74HC74 and the 74HC595 take a clock edge whenever they see one; nothing here refuses data that changed too close to the edge or a clock pulse that was too narrow, and nothing warns about it. A real part would metastable or simply miss.
No supply current, no output current limit and no bus contention damage. An output driving into another output is resolved as two drivers on one net; nothing gets hot.
Sequential parts power up cleared rather than random, because a toggle divider fed Unknown never escapes it. See how faithfully a part behaves.
From The 74HC logic family, in full.
See the 74HC595 shift register in a project
One built-in project uses it. It opens in the editor, already wired.
Where it turns up in a lesson
4 lessons place it in their own circuits.
The boards it is shown on
This board has a built-in project with the 74HC595 shift register in it.
Arduino libraries for the 74HC595 shift register
Built in, so the sketch compiles with nothing to install. Each page has the calls, the wiring and an example to run.
The rest of the bench
Every one of these is drawn and simulated the same way.
Wire up the 74HC595 shift register
Open the editor and push it into the breadboard. It is free, and it runs on your own machine.