Blogroll

Powered by Blogger.

Sunday 21 September 2014

Simple and Easy way to Display 8 in the Last Seven Segment Display (Part 10 of 16)

by realfinetime  |  in Seven Segment Display at  01:26

<<<< Read Previous Part (Part 9)

          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 "8." in eighth 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 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);
          
    // take the latchPin low so the LEDs don't change while you're sending in bits:    
    digitalWrite(latchPin2, LOW);
    //Send 0 1 1 1 1 1 1 1 (127) to Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of 2nd 74595
    shiftOut(dataPin2, clockPin2, MSBFIRST, 127);
    // 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);    
}

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

          Working of program is simple. Program will send 255 (1 1 1 1 1 1 1 1) to the first 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of first 74595 becomes 1 1 1 1 1 1 1 1. After that, program will send 127 (0 1 1 1 1 1 1 1) to second 74595. Then Q7 Q6 Q5 Q4 Q3 Q2 Q1 Q0 of second 74595 becomes 0 1 1 1 1 1 1 1. This will turn on a, b, c, d, e, f, g and dp segments of eighth 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, g and dp segments of a seven segment display is on "8." 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 11)  >>>>

2 comments:

  1. Sir i want to use double 7segment common cathode display with simplest possible circuit
    i want to show 35 or 67 etc
    can i do it with transistors (2N2222) ? like in the link given below
    http://www.datasheetdir.com/circuits/7/How-To-Interface-Seven-segment-Display-With-The-Z8-Encore-Mcu.jpg

    ReplyDelete
  2. I just want to controll double 7segment common cathode display with transistors .
    i don't want to use 4511 or other ic like this.Is it possible
    will the circuit given in this link work ?
    http://www.ele.uri.edu/courses/ele447/proj_pages/JAB/projecthtm/7seglayout.jpg

    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.