Blogroll

Powered by Blogger.

Tuesday, 15 April 2014

Control Seven Segment Display Using 74HC595 Shift Register IC and Arduino

by realfinetime  |  in Seven Segment Display at  05:48

We had already discussed the topic on controlling seven segment display using 4511 Driver IC in the previous tutorials . Here we are going to discuss, how seven segment display can be controlled using 74HC595 IC and Arduino. Circuit is done as shown in the following image. Pin 11 (SH_CP),  Pin 12 (ST_CP) and Pin 14 (DS) of 74595 IC is connected to the Pin 13, Pin12 and Pin11 of Arduino board respectively.


Important :  Seven Segment Display should be common cathode display.
 

Following table shows the states of Q0-Q7 pins of 74HC595 IC to display numbers from 0 to 9. To display a particular number in seven segment display, corresponding EQUIVALENT DECIMAL (column before last column) should be shifted out from Arduino.
Upload the following program to arduino board. Following program displays from 0 to 9 in the seven segment display.


//Pin connected to ST_CP of 74HC595
int latchPin = 12;
//Pin connected to SH_CP of 74HC595
int clockPin = 13;
////Pin connected to DS of 74HC595
int dataPin = 11;

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

void loop() 
{
    // Decimal 63      Binary output  01111111     Displays 0
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 63);  
    digitalWrite(latchPin, HIGH);
    delay(1000);

    // Decimal 6      Binary output  00000110     Displays 1
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 6);  
    digitalWrite(latchPin, HIGH);
    delay(1000);
  
    // Decimal 91      Binary output  01011011     Displays 2
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 91);  
    digitalWrite(latchPin, HIGH);
    delay(1000);

    // Decimal 79      Binary output  01001111     Displays 3  
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 79);  
    digitalWrite(latchPin, HIGH);
    delay(1000);
  
    // Decimal 102      Binary output  01101010     Displays 4  
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 102);  
    digitalWrite(latchPin, HIGH);
    delay(1000);
  
    // Decimal 109      Binary output  01101101     Displays 5  
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 109);  
    digitalWrite(latchPin, HIGH);
    delay(1000);

    // Decimal  125      Binary output  01111101     Displays 6  
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 125);  
    digitalWrite(latchPin, HIGH);
    delay(1000);

    // Decimal  7      Binary output  00000111     Displays 7     
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 7);  
    digitalWrite(latchPin, HIGH);
    delay(1000);
    
    // Decimal 127      Binary  output  01111111     Displays 8    
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 127);  
    digitalWrite(latchPin, HIGH);
    delay(1000);

    // Decimal 102      Binary output  01101111     Displays 9      
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 111);  
    digitalWrite(latchPin, HIGH);
    delay(1000);
    
}

Output of the above program will be as shown in following image.

2 comments:

  1. Amazing Tutorial

    ReplyDelete
  2. // Decimal 102 Binary output 01101010 Displays 4
    01101010 - wrong value, should be 01100110

    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

Proudly Powered by Blogger.