Strange shift register behaviour

Hi Guys,

I have hooked up 3 shift registers with 3 x 7 segment displays. Whenever I upload any value to display on the first shift register the other 2 shift registers also light up the same L.E.D.

I am using a modified version of the code on Arduino’s website. In the code below I am telling it to display “1”:
// shiftOut ( dataPin, clockPin, MSBFIRST, 1 ) ; //

I have followed Arduino’s tutorial on how to hookup all the pins on the shift registers. The photo with the schematic is a view of the shift registers from the bottom.

Can someone tell me what I am doing wrong or is this normal?

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

void setup() {
  pinMode(latchPin, OUTPUT);
  pinMode(clockPin, OUTPUT);
  pinMode(dataPin, OUTPUT);
}

void loop() {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 1);  
    digitalWrite(latchPin, HIGH);
  }

Thank You

Danny

It's because you're in a loop(). It gets called continuously, so it keeps shifting. Otherwise, it's probably fine. Try putting in a delay, or a delay and different numbers.

eg:

void loop() {
    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 1);  
    digitalWrite(latchPin, HIGH);
    delay(1000);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 2);  
    digitalWrite(latchPin, HIGH);
    delay(1000);

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, 3);  
    digitalWrite(latchPin, HIGH);
    delay(1000);

  }

Hi,

The code you posted separates the first and second 7 segment displays but still the second and third are moving together.

Is this because I have a problem in my circuitry, or is this normal behavior of shift registers

Thank You

Danny

7seg.mp4 (3.3 MB)

No, it's not normal. I'd check your wiring of segments 2 and 3.

By the way, the way it works is every time you call shift, it moves the data of each 7-segment LED to the 7-segment LED to the right of it. A shift "shifts" it to the next one over. That's why I say it's not normal for shift registers. Each call to shift should move the data downstream to the next one, with the first one being given a brand new value. This is why I think you have a cabling problem.

Hi,

Thank you for your time to answer my questions. I will double-check my wiring ...

Thank You

Danny