Blogroll

Powered by Blogger.

Thursday 28 August 2014

Arduino Program to Turn on All LEDs of 8*8 LED Matrix using 74595 Shift Register

by realfinetime  |  in LED Matrix at  01:15

Previous : Control 8*8 LED Matrix using 74595 and Arduino

          We have already seen the circuit to connect 8*8 LED matrix to arduino through 8 bit shift register 74595 in previous blog. Next is a simple program to turn on all LEDs of an 8*8 LED matrix. LED matrix will look like as shown in the following image.

Upload the following program to your arduino board.

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

int latchPin2 = 6;  //Pin connected to ST_CP of 2nd 74595
int clockPin2 = 7;  //Pin connected to SH_CP of 2nd 74595
int dataPin2 = 5;   //Pin connected to DS of 2nd 74595

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

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


    /********** Send LOW to all Cathode pins of LED matrix **********/    
    
    // take the latchPin low so the LEDs don't change while you're sending in bits:    
    digitalWrite(latchPin2, LOW);
    //Send 0 0 0 0 0 0 0 0 (0) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 0);
    // shift out the bits:  
    digitalWrite(latchPin2, HIGH);
}

          If uploading is successful, all LEDs in LED matrix will turn on. Working of program is simple. Q0 to Q7 pins of first IC is connected to the anode pins of 8*8 LED matrix as given in the previous blog. Arduino will send 255 (1 1 1 1 1 1 1 1) to the first shift register IC. When 255 is shifted out, Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 of first shift register will output 1 1 1 1 1 1 1 1. Hence, all the anode pins of LED matrix will get HIGH voltage.

          Similarly Q0 to Q7 pins of second IC is connected to the cathode pins of 8*8 LED matrix. Arduino will send 0 (0 0 0 0 0 0 0 0) to the second shift register IC. When 0 is shifted out, Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 of second shift register will output 0 0 0 0 0 0 0 0. Hence, all the cathode pins of LED matrix will get LOW voltage. That is, all LEDs will get HIGH voltage at anode and LOW voltage at cathode. This will turn on all LEDs.

Next: Arduino Program to Turn on First LED of 8*8 LED Matrix

1 comment:

IMPORTANT NOTICE

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.