Hello. I am trying to control 3 led matrices using 4 74HC595 shift registers. This a smaller prototype for a larger project I plan on building. To use less resistors I have wired to anode to do the multiplexing. My problem is that the bits don't shift correctly.
The image is wired like so:
MR (active low) = wired to all four shift registers
STCP (Clock) = wired to all four shift registers
SHCP (Latch) = wired to all four shift registers
DIN (Serial Input) = wired to the shift register #1
Q7S (Serial Output) = Wired from shift register #1 to DIN of #2. Q7S of #2 to DIN of #3....ect
//Variables//
//PIN NUMBERS
int MASTER_RESET = 4;
int SHCP = 5;
int STCP = 7;
int DISPLAY_INPUT = 6;
//VALUES
int delayTime = 25;
//Main Methods//
void setup(){
pinMode(MASTER_RESET, OUTPUT);
pinMode(SHCP, OUTPUT);
pinMode(STCP, OUTPUT);
pinMode(DISPLAY_INPUT, OUTPUT);
digitalWrite(MASTER_RESET, LOW);
digitalWrite(MASTER_RESET, HIGH);
}
//Methods//
void loop(){
//EACH 8x8 block of array controls 1 Shift register
//First block will refresh matrix, #1,2,3 will light up certain leds
//current array will turn all leds on
boolean num[] = {1,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,1,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,1,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,1,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,1,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,1,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,1,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,1, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0};
for(int i = 0; i < 8; i++){
for(int t = 0; t < 32; t++){
//LOAD 32 BIT BINARY CODE
digitalWrite(DISPLAY_INPUT, num[t+(i*32)]);
digitalWrite(STCP, HIGH);
digitalWrite(STCP, LOW);
}
//OUTPUT 32 BITS
digitalWrite(SHCP, HIGH);
digitalWrite(SHCP, LOW);
delay(delayTime);
}
}
Any help would be appreciated. Thanks!