Notifications
Clear all

Shift registers

5 Posts
4 Users
6 Likes
1,367 Views
Duce robot
(@duce-robot)
Member
Joined: 5 years ago
Posts: 680
Topic starter  

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


   
Quote
jker
 jker
(@jker)
Member
Joined: 3 years ago
Posts: 82
 

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."


   
ReplyQuote
hstaam
(@hstaam)
Mr.
Joined: 5 years ago
Posts: 61
 

Great explanation!

Thanks for sharing this.

hj


   
Inst-Tech reacted
ReplyQuote
Duce robot
(@duce-robot)
Member
Joined: 5 years ago
Posts: 680
Topic starter  

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


   
Inst-Tech reacted
ReplyQuote
(@davemc)
Member
Joined: 3 years ago
Posts: 3
 

Thank you for posting this. Numerous sites I've seen explain how to assemble cascading but don't explain the programming or do so with unnecessary complexity and confusion. I expected something simple like this but, as a newbie to this, didn't want to make wrong assumptions.


   
Inst-Tech reacted
ReplyQuote