I've build a daisy chain of 3 x 74HC595 shift registers with LEDs on their outputs. They are fed by an Arduino that is pushing a single bit through all the registers and will finally clear the register via the MR pin.
Pushing the bit seems to work fine, but when it comes to the last shift register, something strange happens: When the bit reaches Q6, Q7S on that register also lights up. Then Q6 (and Q7S) go dark and only Q7 lights up.
I can't figure out why Q7S lights up on the last register. I've also changed the register with a new one, but the problem persists.
Maybe I've got a misunderstanding about the workings of the 74HC595, but I'd expect Q7S only to light up AFTER Q7.
Any things I should look into?
edit: This is my schematics. Each ROW/COL pin on the shift registers is connected to an LED which is then connected to GND.
This is my test code:
void setup() {
#define DS 4
#define STCP 6
#define SHCP 7
#define MR 8
pinMode(DS, OUTPUT);
pinMode(STCP, OUTPUT);
pinMode(SHCP, OUTPUT);
pinMode(MR, OUTPUT);
#define NUM 24
}
void loop() {
// clear everything from registers
digitalWrite(MR, LOW);
delay(100);
digitalWrite(MR, HIGH);
// shift 1 bit through all registers
for(int i = 0; i <= NUM; i++) {
// activate storage mode
digitalWrite(SHCP, LOW);
// set only the first bit to high
digitalWrite(STCP, LOW);
if(i == 0) {
digitalWrite(DS, HIGH);
} else {
digitalWrite(DS, LOW);
}
digitalWrite(STCP, HIGH);
// disable storage mode / write data to output register
digitalWrite(SHCP, HIGH);
delay(200);
}
delay(2000);
// turn them all off
for(int i = 0; i < NUM; i++) {
digitalWrite(SHCP, LOW);
digitalWrite(STCP, LOW);
digitalWrite(DS, LOW);
digitalWrite(STCP, HIGH);
digitalWrite(SHCP, HIGH);
}
}