Powered by Blogger.

Sunday, 13 April 2014

Serial to Parallel Shifting - Out with Two Shift Register ICs 74HC595 and Arduino

by realfinetime  |  in ATmega328 at  07:00

Important: Before starting this tutorial, don't forget to refer the tutorial on connecting one 74595 IC to Arduino.

If we want more outputs than the outputs from one 74595 IC, we will go for more 74595 ICs. Pinout diagram of 74595 is given below.

While using more ICs, Pin 11 (SH_CP) and Pin 12 (ST_CP) of all 74595 ICs must be connected to the same pins of arduino board. Pin 14 (DS) of the first 74595 IC must be connected to the Arduino pin. Pin 14 of all the other 74595 ICs must be connected to the Pin 9 ( Q7' ) 
of the previous IC as shown in the following figure.

Complete the circuit as shown in figure given above. Now upload the following program to your arduino board.

//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() {
  // count from 0 to 255 and display the number 
  // on the LEDs
  for (int numberToDisplay = 0; numberToDisplay < 256; numberToDisplay++) {
    // take the latchPin low so 
    // the LEDs don't change while you're sending in bits:
    digitalWrite(latchPin, LOW);
    // shift out the bits:
    shiftOut(dataPin, clockPin, MSBFIRST, numberToDisplay);

    //take the latch pin high so the LEDs will light up:
    digitalWrite(latchPin, HIGH);
    // pause before next value:

Output of the above program will be as shown in figure given below.

First row of following image indicates Q0 - Q7 of IC 1. Second row indicates Q0 -Q7 of IC 2.

                                                Q7     Q6     Q5    Q4     Q3    Q2     Q1    Q0

Explanation of the Output.

During the first shiftout (First iteration of for loop1 (00000001) will be displayed in the LEDs connected to the first IC. During the second shiftout (Second iteration of for loop), 1 (00000001) will be shifted to the second IC and 2 (00000010) will be displayed in the first IC. 



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.