Powered by Blogger.

Thursday 11 September 2014

Arduino Program For Cascade Operation of Two 74HC595/74HCT595

by realfinetime  |  in Electronics at  04:09

Previous:  Circuit for Cascade Operation of Two 74595

          We have already designed the circuit for cascade operation of 74HC595/74HCT595 using arduino. Now, upload the following program to your arduino board.

int latchPin = 11;  //Pin connected to ST_CP of 1st 74595
int clockPin = 12;  //Pin connected to SH_CP of 1st 74595
int dataPin = 13;   //Pin connected to DS of 1st 74595

void setup() {
  //set pins to output so you can control the shift register
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);

void loop() {
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 1 1 1 0 0 0 0 (255) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 240);  
    //Send 0 0 0 0 1 1 1 1 (3) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 15);
    // shift out the bits:    
    digitalWrite(latchPin, HIGH);

Output of the above program is shown below.

          LEDs connected to the, Q0, Q1, Q2 and Q3 pins of 1st 74595 turn on. Similarly, LEDs connected to the Q4, Q5, Q6 and Q7 of 2nd 74595 turn on. Arduino shift out decimal number 240 first. 240 will be stored in first 74595. After that, arduino will shiftout decimal number 15. During the second shift out (when 15 is shifted out), 240 will be shifted from first 74595 to second 74595 and 15 will be stored in first 74595. Second 74595 will store 240. As a result we will get the output as shown in diagram.

Next:  16*8 LED Matrix Using Arduino and 74595


  1. Allow me to assume that you first wanted to send 11111100 (255) and 00000011 (3), but then decided to send 11110000 (240) and 00001111 (15), but you forgot to change the digital number in the comment



All the circuits, published in this blog is only after testing and getting proper results in my private lab. When you try these circuits, you should check the supply voltage, polarity of components, presence of childrens nearby and shorts in the circuits. This website will not be responsible for any harm happened to you or your components caused by your carelessness.

For More Electronic Tips

Blog Archive

Proudly Powered by Blogger.