The 74HC595 is an 8-bit serial-in, parallel-out shift register with a storage register and tri-state outputs. It is widely used in electronics to expand the number of output pins available on a microcontroller, such as an Arduino. By using a serial data input, the 74HC595 allows you to control up to 8 output pins with just 3 control pins from the microcontroller. Additionally, multiple 74HC595 chips can be cascaded to control even more outputs.
The following table outlines the key technical details of the 74HC595:
Parameter | Value |
---|---|
Supply Voltage (Vcc) | 2V to 6V |
Input Voltage (VI) | 0V to Vcc |
Output Current (IO) | ±6 mA per pin |
Maximum Clock Frequency | 25 MHz (at 4.5V) |
Operating Temperature | -40°C to +125°C |
Propagation Delay | ~20 ns (at 5V) |
Package Types | DIP-16, SOIC-16, TSSOP-16 |
The 74HC595 has 16 pins, as described in the table below:
Pin Number | Pin Name | Description |
---|---|---|
1 | Q1 | Parallel output pin 1 |
2 | Q2 | Parallel output pin 2 |
3 | Q3 | Parallel output pin 3 |
4 | Q4 | Parallel output pin 4 |
5 | Q5 | Parallel output pin 5 |
6 | Q6 | Parallel output pin 6 |
7 | Q7 | Parallel output pin 7 |
8 | GND | Ground (0V) |
9 | Q7' | Serial data output for cascading additional 74HC595 chips |
10 | MR | Master Reset (active LOW) - Clears all outputs |
11 | SH_CP | Shift Register Clock Input - Shifts data into the register on rising edge |
12 | ST_CP | Storage Register Clock Input (Latch) - Transfers data to output on rising edge |
13 | OE | Output Enable (active LOW) - Enables/disables outputs |
14 | DS | Serial Data Input |
15 | Q0 | Parallel output pin 0 |
16 | Vcc | Positive supply voltage |
To use the 74HC595, connect it to your microcontroller as follows:
Vcc
to the microcontroller's 5V pin and GND
to ground.DS
(Pin 14) to the microcontroller's data pin (e.g., Arduino D11
).SH_CP
(Pin 11) to the microcontroller's clock pin (e.g., Arduino D12
).ST_CP
(Pin 12) to the microcontroller's latch pin (e.g., Arduino D8
).OE
(Pin 13) to ground to enable the outputs.MR
(Pin 10) to Vcc to disable the reset function.To control more than 8 outputs, you can cascade multiple 74HC595 chips:
Q7'
(Pin 9) of the first chip to the DS
(Pin 14) of the second chip.SH_CP
, ST_CP
, and OE
pins across all chips.Below is an example of connecting a single 74HC595 to an Arduino UNO to control 8 LEDs:
74HC595 Pin 14 (DS) -> Arduino Pin 11
74HC595 Pin 11 (SH_CP) -> Arduino Pin 12
74HC595 Pin 12 (ST_CP) -> Arduino Pin 8
74HC595 Pin 13 (OE) -> GND
74HC595 Pin 10 (MR) -> Vcc
74HC595 Pin 16 (Vcc) -> Arduino 5V
74HC595 Pin 8 (GND) -> Arduino GND
74HC595 Pins Q0-Q7 -> LEDs (with current-limiting resistors)
Here is an example Arduino sketch to control 8 LEDs using the 74HC595:
// Define 74HC595 control pins
const int dataPin = 11; // DS (Serial Data Input)
const int clockPin = 12; // SH_CP (Shift Register Clock)
const int latchPin = 8; // ST_CP (Storage Register Clock)
// Function to send data to the 74HC595
void shiftOutData(byte data) {
digitalWrite(latchPin, LOW); // Disable latch to update data
shiftOut(dataPin, clockPin, MSBFIRST, data); // Send data (MSB first)
digitalWrite(latchPin, HIGH); // Enable latch to output data
}
void setup() {
// Set control pins as outputs
pinMode(dataPin, OUTPUT);
pinMode(clockPin, OUTPUT);
pinMode(latchPin, OUTPUT);
}
void loop() {
// Turn on LEDs one by one
for (byte i = 0; i < 8; i++) {
shiftOutData(1 << i); // Shift a single HIGH bit through the register
delay(200); // Wait 200ms
}
// Turn off LEDs one by one
for (byte i = 0; i < 8; i++) {
shiftOutData(~(1 << i)); // Shift a single LOW bit through the register
delay(200); // Wait 200ms
}
}
Issue | Possible Cause | Solution |
---|---|---|
LEDs not lighting up | Incorrect wiring or loose connections | Double-check all connections and ensure proper wiring. |
Outputs not updating | Latch pin (ST_CP ) not toggled correctly |
Ensure the latch pin is toggled HIGH after sending data. |
Cascaded chips not working | Incorrect connection of Q7' to DS |
Verify the Q7' of the first chip is connected to the DS of the next chip. |
Flickering LEDs | Clock signal is noisy or too fast | Use a lower clock frequency or add decoupling capacitors near the chip. |
Outputs always HIGH or LOW | OE or MR pins not properly connected |
Ensure OE is grounded and MR is connected to Vcc. |
Can I use the 74HC595 with 3.3V microcontrollers?
How many 74HC595 chips can I cascade?
Do I need resistors for LEDs connected to the 74HC595?
What is the purpose of the OE
pin?
OE
pin enables or disables the outputs. When HIGH, all outputs are in a high-impedance state.This documentation provides a comprehensive guide to using the 74HC595 shift register. Whether you're a beginner or an experienced user, the 74HC595 is a versatile and essential component for expanding your microcontroller's output capabilities.