8-bit Serial-In Parallel-Out (SIPO) Shift Register
Use the 74HC595 shift register to expand the number of output pins on your microcontroller. For input shift register (e.g. reading multiple buttons with a single input pin), please see the wokwi-74hc165.
|STCP||Storage (latch) pin|
|OE||Output enable, active low. Connect to GND if not used.|
|MR||Reset (clear), active low. Connect to VCC if not used|
* Use the Q7S to chain multiple 74HC595 units together. Connect Q7S to the DS pin of the next 74HC595 chip in chain.
You will need to connect at least 3 pins to your microcontroller: DS, SHCP, and STCP.
The OE pin can be used to disable the output of the shift register. If you need that functionality, connect it to your microcontroller. Otherwise, connect it to the ground to permanently enable the output.
The output pins of the shift register, Q0 through Q7, are usually connected to LEDs or a 7-segment display.
The following code example assumes that you connected DS to Arduino pin 2, SHCP to Arduino pin 3, and STCP to Arduino pin 4. It outputs an 8-bit pattern that inverts two times a second:
You can also run this example on Wokwi.