Glitchy 5x7 LED matrix. (SOLVED - STUPID MISTAKE)

Hello!

I made this 5x7 led matrix by using multiplexing, but there seems to be a small, but serious issue that i cant figure out. Basically when i run the code normally without any delays added to the display0() method i get a weird glitch that doesnt display the digit ZERO correctly. It looks like as if the previous rows output is being shown at the same time as the current row. The thing is when i run the code at a delay of aroud 3ms then this issue is less visible, only with very small to no delays. I tried debugging it by using 500ms delay and everything seemed to work perfectly fine, the rows lit up as they should and nothing was wrong, but at a fast speed it all goes glitchy. Pictures are added, one with a 3ms delay (the one showing a nice zero) and another with no delay (weird glitchy zero).

int clk = 2;
int latch= 3;
int data = 4;
int clkSel = 5;
int latchSel = 6;
int dataSel = 7;

byte arrayTable[7] = //a 5x7 LED martix for displaying the digit ZERO by multiplexing
{
  B11110001,
  B11101110,
  B11101110,
  B11101110,
  B11101110,
  B11101110,
  B11110001,
};
void reset();
void display0();
void show();
void shift(byte);
void shiftSel(bool);


//------------------------------------

void setup(){
  for(int i = 2; i < 8; i++){
    pinMode(i, OUTPUT);
  }
  digitalWrite(clk, LOW);
  digitalWrite(latch, LOW);
  digitalWrite(latchSel, LOW);
  digitalWrite(clkSel, LOW);
  reset();
}

void loop() {
  display0(arrayTable);
}

//------------------------------------------------

void display0(byte myArray[7]){//take the data for displaying the digit
  shiftSel(1);                 //select first row
  
  for(int i = 0; i < 7; i++){
    shift(myArray[i]);         //put i-th row data from table
    show();                    //show current register outputs
    //delay(3);
    //delay(500);
    shiftSel(0);               //shift to next row
  }
}

//uploads sequence for a given row
void shift(byte values){
  byte val = values;
  for(int i = 0; i < 5; i++){
    digitalWrite(data, val & 1);
    val = val >> 1;
    digitalWrite(clk, HIGH);
    digitalWrite(clk, LOW);
  }
}

//pushes the next bit
void shiftSel(bool cycle){
  digitalWrite(dataSel, cycle);
  digitalWrite(clkSel, HIGH);
  digitalWrite(clkSel, LOW);
}


void reset(){
  for(int i = 0; i < 8; i++){
    //reset anode
    digitalWrite(data, HIGH);
    digitalWrite(clk, HIGH);
    digitalWrite(clk, LOW);
    //reset cathode
    digitalWrite(dataSel, LOW);
    digitalWrite(clkSel, HIGH);
    digitalWrite(clkSel, LOW);
  }
}

//displays buffered output
void show(){
  digitalWrite(latch, HIGH);
  digitalWrite(latch, LOW);
}

NOTE: Ignore the latchSel pin, its a leftover i didnt care much about after i changed the code a bit. The general idea is that the rows are being controlled by one shift register 74HC595, which connect the + pins of the leds, thus conduct when outputs are HIGH, and the columns are being controlled by another shift register, but this one acts as a current sink, thus conducts when outputs are LOW with the - pin of the leds. The matrix for my digit is saved in arrayTable.

I was actually wondering if this might have something to do with a small capacitor in the arduino UNO, which at higher frequencies of the loop causes this. Is that a posibility?

Bump. Could anyone help me with this issue? I have a deadline for the project, the sooner i figure this out the better. Tried some more debugging but still nothing helped :confused:

Atan74:
Bump.

remember the 24hr clock ? we don't all live in the same part of the world as you. Also you didn't include the circuit schematic.

Sorry it’s just that this matter is rather urgent for me, just being impatient. One of my many flaws :confused: Here is the scheme. I skipped connecting the wiring for 5V and GND because that is obvious how its connected. Im powering the UNO from my PC connection and using the 5V and GND pin to power the registers. Also the OE pin on both registers is on 5V while MR is on GND. That way i don’t let them reset using the MR signal and i always keep the OE on so it always works. Not sure if any of this will help but here is the scheme

EDIT: Found the problem, I was braindead and accidentally connected the latch pin to the clk pin of the other register when the cable disconnected. I guess i wasn’t looking well to which hole i was putting it and it was 1 off, now everything works super well. The shifting was off because the latch was working after the clock hence why two rows were being shown. Sorry for the trouble jesus x_x

Schematic_Clock-module_Sheet-1_20190327174801.pdf (38 KB)