Blogroll

Powered by Blogger.

Sunday, 21 September 2014

Display 0 in a Seven Segment Display of a Cluster of Displays using Arduino (Part 11 of 16)

by realfinetime  |  in Seven Segment Display at  02:54

<<<< Read Previous Part (Part 10)

          We have found the circuit for controlling a cluster of 8 common cathode seven segment displays using arduino and 74595 in previous blogs. Click here to start reading from the beginning of "controlling a cluster of eight common cathode seven segment displays using arduino and 74595".

          Here, we will generate an arduino program that will display "0." in first common cathode seven segment display as given below.


Circuit is given here. Complete that circuit and 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() {
  
    // take the latchPin low so the LEDs don't change while you're sending in bits:     
    digitalWrite(latchPin, LOW);
    //Send 1 0 1 1 1 1 1 1 (191) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 1st 74595
    shiftOut(dataPin, clockPin, MSBFIRST, 191);
    // shift out the bits:    
    digitalWrite(latchPin, HIGH);
          
    // take the latchPin low so the LEDs don't change while you're sending in bits:    
    digitalWrite(latchPin2, LOW);
    //Send 1 1 1 1 1 1 1 0 (254) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 254);
    // shift out the bits:  
    digitalWrite(latchPin2, HIGH); 
    

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

"0." will be displayed in the first common cathode seven segment display. All other seven segment displays will turn off.
Working of program

          Working of program is simple. Program will send 191 (1 0 1 1 1 1 1 1) to the first 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of first 74595 becomes 1 0 1 1 1 1 1 1. After that, program will send 254 (1 1 1 1 1 1 1 0) to second 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of second 74595 becomes 1 1 1 1 1 1 1 0. This will turn on a, b, c, d, e, f and dp segments of first common cathode seven segment display and turn off all other seven segment displays as shown in the following image. When a, b, c, d, e, f and dp segments of a seven segment display is on "0." will be displayed in the seven segment display.

          After displaying these, arduino will send 255 (1 1 1 1 1 1 1 1) to the second 74595 to turn off all the seven segment displays. Use of this function will be more clear, when you try to turn on more than one seven segment display at a time.

Continued in Next Page (Part 12)  >>>>

1 comment:

  1. Hello . thanks for good tutorials .how to print data from dht11 temperature /humidity sersor used this led display . it is possible ?

    ReplyDelete

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.