How does 74hc595 shift register work | Step by step instructions
How does the 74hc595 shift register work?
Hello, welcome back. In this tutorial, I will show you how does 74hc595 shift register work with Arduino. This tutorial is especially important if you want to get a lot of outputs using three PINs on an Arduino or other microcontroller. Also, this is explained using Arduino in this tutorial. For that, 8 LEDs were used. Without VCC and GND, this LED 8 is controlled by three digital pins. One shift register is used for that. You can connect these as many as you want. However, only 3 pins are required for this. You can use the knowledge in this tutorial to create an LED matrix, LED cube, etc.
(adsbygoogle = window.adsbygoogle || []).push({});What is the 74HC595 Shift register IC and how does it work?
PIN structure of this 74HC595 shift register.
- Q0 to Q7 — Output PINs.
- GND — connect to the Arduino GND.
- VCC — Connect to the VIN or 5v.
- SER — Data sending pin.
- OE — When this pin is HIGH, the output pins are disabled and current flow is prevented. Also, when this pin is low, the output pins work normally.
- RCLK — Register clock PIN (Described above)
- SRCLK — Serial clock (Described above)
- SRCLR — This pin is used to reset the memory in the shift register.
- Q7` — This pin is used to connect another shift register.
- Arduino UNO board x 1 — Amazon / Our Store
- 74HC595 shift register x 1 — Amazon / Our Store
- LED x 8 — Amazon / Our Store
- 180-ohm resistors x 8 — Amazon / Our Store
- Breadboard x 1 — Amazon / Our Store
- Jumper wires — Amazon / Our Store
Step 1
Arduino UNO board
74HC595 shift register
LED bulb
180-ohm resistors
Breadboard
Jumper wires
(adsbygoogle = window.adsbygoogle || []).push({});Step 2
Step 3
/*How to use 74hc595 shiftRegister.
Four LED patterns.
created by the SriTu Tech team.
Read the code below and use it for any of your creations.
*/
#include <ShiftRegister74HC595.h>//include library
ShiftRegister74HC595<1> led(4, 2, 3);//<number of shiftregisters>object name(data pin,clock pin,latch pin)
void setup() {
}
void loop() {
pattern1(2);
pattern2(2);
pattern3(2);
pattern4(2);
}
void pattern1(int a) {
for (int x = 0; x < a; x++) {
led.setAllHigh();
delay(300);
led.setAllLow();
delay(300);
}
}
void pattern2(int a) {
for (int x = 0; x < a; x++) {
for (int a = 0; a < 8; a++) {
led.set(a, HIGH);
delay(100);
led.set(a, LOW);
}
for (int b = 7; b > 0; b--) {
led.set(b, HIGH);
delay(100);
led.set(b, LOW);
}
}
}
void pattern3(int a) {
for (int x = 0; x < a; x++) {
for (int a = 0; a < 8; a++) {
led.set(a, HIGH);
delay(100);
}
for (int b = 7; b > 0; b--) {
led.set(b, LOW);
delay(100);
}
}
}
void pattern4(int a) {
for (int x = 0; x < a; x++) {
for (int a = 0; a < 8; a++) {
led.set(a, LOW);
delay(100);
led.set(a, HIGH);
}
for (int b = 7; b > 0; b--) {
led.set(b, LOW);
delay(100);
led.set(b, HIGH);
}
}
}
Code explanation
Step 4
How does 74hc595 shift register work | Step by step instructions