Notifications
Clear all

Shift registers  


Duce robot
(@duce-robot)
Honorable Member
Joined: 2 years ago
Posts: 551
Topic starter  

I was wondering if anyone knows how to cascade shift registers thanks for any input 😁👍🤖


Quote
jker
 jker
(@jker)
Eminent Member
Joined: 6 months ago
Posts: 43
 

Fortunately, this is a pretty common need, so the common shift registers are designed to cascade.

For output or control registers (SIPO) 74HC595, let's say you have four chips and you are trying to control 32 outputs. https://www.ti.com/lit/ds/symlink/sn74hc595-ep.pdf

All four 595's connect pins 12 (latch) and 11 (clock) together to the same output pins on the microcontroller. (All of them also need power and ground on various pins such as 8, 16, 10 and 13 in the normal 16 pin package)  Pins 1-7 and 15 on each are connected to your outputs.

Your data out line from the microcontroller is fed into pin 14 (data in) of the first 595, and pin 9 (QH') on that is connected to the next 595's pin 14. This second 595's pin 9 is connected to the third's pin 14, and likewise for the third to the fourth.

The arduino code is similar to the single chip case.

digitalWrite(latchPin, LOW); // Drive the latch pin low, which will make all 4 chips wait for your data
shiftOut(dataPin, clockPin, LSBFIRST or MSBFIRST, data_for_the_fourth_chip);
shiftOut(dataPin, clockPin, LSBFIRST or MSBFIRST, data_for_the_third_chip);
shiftOut(dataPin, clockPin, LSBFIRST or MSBFIRST, data_for_the_second_chip);
shiftOut(dataPin, clockPin, LSBFIRST or MSBFIRST, data_for_the_first_chip);
digitalWrite(latchPin, HIGH);

If you're looking for a large number of inputs, the situation is basically the same for the 165 model ( https://www.ti.com/lit/ds/symlink/sn74hc165.pdf). In this case, connect your microcontroller input pin to the first 165's pin 9. Connect that 165's pin 10 to the next 165's pin 9, etc. The 165 datasheet actually includes an example wireup of this scenario. In this case, the first chips data will be the first to come in with the shiftIn function call, followed by the second, etc.

"A resistor makes a lightbulb and a capacitor makes an explosion when connected wrong"
"There are two types of electrical engineers, those intentionally making antennas and those accidentally doing so."


Duce robot and hstaam liked
ReplyQuote
hstaam
(@hstaam)
Trusted Member
Joined: 2 years ago
Posts: 75
 

Great explanation!

Thanks for sharing this.

hj


ReplyQuote
Duce robot
(@duce-robot)
Honorable Member
Joined: 2 years ago
Posts: 551
Topic starter  

@jker awesome thanks. This should work well .I'm only doing 2 595 so it shouldn't be th o difficult. 😁👍


ReplyQuote