Sevent segments hc595 problem

Hello, I need a little help since I have a problem with my project using three shift registers hc595 and three 7-segment displays.

My problem is that I load my board with a counter program from 0 to 999 and the program works, the problem is that when it displays the digits I get small, very faint blinks on my counter and I need them to be gone. Has anyone had a similar problem? I attach my code and photo of the displays.

 #define SER A0    //data
 #define RCLK PE1  // LATCH
 #define SRCLK A1  //            CLOCK
 #define Btn A6

uint8_t display[] = { B11111001, B11000000, B10110101, B11100101, B11001100, B01101101, B01111101, B11000001, B11111101, B11001101 };
unsigned long tiempoAnterior = 0;
void setup() {
  pinMode(SER, OUTPUT);
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  digitalWrite(RCLK, LOW);
  digitalWrite(RCLK, HIGH);
void loop() {
  tiempoActual = millis();
  if ((tiempoActual - tiempoAnterior) > 100) {
    carga(i, j, k);
    i++;
    if (i > 9) {
      i = 0;
      j++;
    }
    if (j > 9) {
      j = 0;
      k++;
      if (k > 9) {
        i = 0;
        j = 0;
        k = 0;
      }
    }
    tiempoAnterior = millis();
  }
}
int carga(int digito1, int digito2, int digito3) {
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[i]);
  digitalWrite(RCLK, HIGH);
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[j]);
  digitalWrite(RCLK, HIGH);
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[k]);
  digitalWrite(RCLK, HIGH);
  // delay(50);
  

  
}

im kind of new so i apologize for any mistake.

Show your schematic.
How the resistors are connect to 7seg?

What is a counter?

No.

You never use A6.

This one compiles.

#define SER A0    // DATA / DS
#define RCLK A2   // LATCH / STCP
#define SRCLK A1  // CLOCK / SHCP
#define Btn A6 // a button - never used
int i, j, k; // digits 1, 2, 3

uint8_t display[] = { 
  B11111001, // 0
  B11000000, // 1
  B10110101, // 2
  B11100101, // 3
  B11001100, // 4
  B01101101, // 5
  B01111101, // 6
  B11000001, // 7
  B11111101, // 8
  B11001101  // 9
  };

unsigned long tiempoAnterior = 0, tiempoActual;

void setup() {
  pinMode(SER, OUTPUT);
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);

  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);

  digitalWrite(RCLK, LOW);
  digitalWrite(RCLK, HIGH);
}

void loop() {
  tiempoActual = millis();
  if ((tiempoActual - tiempoAnterior) > 100) {
    carga(i, j, k);
    i++;
    if (i > 9) {
      i = 0;
      j++;
    }
    if (j > 9) {
      j = 0;
      k++;
      if (k > 9) {
        i = 0;
        j = 0;
        k = 0;
      }
    }
    tiempoAnterior = millis();
  }
}

int carga(int digito1, int digito2, int digito3) {
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[i]);
  digitalWrite(RCLK, HIGH);
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[j]);
  digitalWrite(RCLK, HIGH);
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[k]);
  digitalWrite(RCLK, HIGH);
  // delay(50);
}
diagram.json

{
  "version": 1,
  "author": "Anonymous maker",
  "editor": "wokwi",
  "parts": [
    { "type": "wokwi-arduino-nano", "id": "nano", "top": 0, "left": 0, "attrs": {} },
    { "type": "wokwi-74hc595", "id": "sr1", "top": 94.8, "left": 24.64, "attrs": {} },
    {
      "type": "wokwi-pushbutton",
      "id": "btn1",
      "top": -51.4,
      "left": 134.4,
      "attrs": { "color": "green" }
    },
    {
      "type": "wokwi-led-bar-graph",
      "id": "bargraph1",
      "top": 110.2,
      "left": 43.4,
      "rotate": 90,
      "attrs": { "color": "lime" }
    },
    { "type": "wokwi-vcc", "id": "vcc1", "top": 29.56, "left": -28.8, "attrs": {} }
  ],
  "connections": [
    [ "nano:GND.2", "btn1:2.l", "black", [ "v0" ] ],
    [ "nano:A0", "sr1:DS", "green", [ "v0" ] ],
    [ "nano:A1", "sr1:SHCP", "green", [ "v14.4", "h18.7" ] ],
    [ "nano:A2", "sr1:STCP", "green", [ "v0" ] ],
    [ "nano:GND.1", "sr1:OE", "black", [ "v24", "h-86.9" ] ],
    [ "btn1:1.l", "nano:A6", "green", [ "h0" ] ],
    [ "bargraph1:C10", "bargraph1:C9", "green", [ "v0" ] ],
    [ "bargraph1:C9", "bargraph1:C8", "green", [ "v0" ] ],
    [ "bargraph1:C8", "bargraph1:C7", "green", [ "v0" ] ],
    [ "bargraph1:C7", "bargraph1:C6", "green", [ "v0" ] ],
    [ "bargraph1:C6", "bargraph1:C5", "green", [ "v0" ] ],
    [ "bargraph1:C5", "bargraph1:C4", "green", [ "v0" ] ],
    [ "bargraph1:C4", "bargraph1:C3", "green", [ "v0" ] ],
    [ "bargraph1:C3", "bargraph1:C2", "green", [ "v0" ] ],
    [ "bargraph1:C1", "bargraph1:C2", "green", [ "v0" ] ],
    [ "sr1:VCC", "vcc1:VCC", "red", [ "v-18", "h-48" ] ],
    [ "vcc1:VCC", "nano:5V", "red", [ "v19.2", "h144" ] ],
    [ "sr1:Q0", "bargraph1:A10", "green", [ "v-8.4", "h-28.8" ] ],
    [ "sr1:Q1", "bargraph1:A9", "green", [ "v0" ] ],
    [ "sr1:Q2", "bargraph1:A8", "green", [ "v0" ] ],
    [ "sr1:Q3", "bargraph1:A7", "green", [ "v0" ] ],
    [ "sr1:Q4", "bargraph1:A6", "green", [ "v0" ] ],
    [ "sr1:Q5", "bargraph1:A5", "green", [ "v0" ] ],
    [ "sr1:Q6", "bargraph1:A4", "green", [ "v0" ] ],
    [ "sr1:Q7", "bargraph1:A3", "green", [ "v0" ] ],
    [ "sr1:GND", "nano:GND.1", "black", [ "v9.6", "h9.6", "v-48", "h38.4" ] ]
  ],
  "dependencies": {}
}

That sketch in the first post does not compile.

So can you post the sketch that you claim works except for the faint blinking, please.

Why latching after every shiftout?

Absolutely no reason, except that is the way the OP did it in his code, and it has no effect.

Thank you very much for taking the time to respond. Here is my diagram, it is not exactly which pin goes with which pin but it is the idea. I am controlling the hc595 with an atmega328pb that sends the signals to a uln2803 to drive a 7 sec display that is powered at 12v

Thank you very much for taking the time to respond. And sorry if I haven't explained it properly.

What is a counter?

I'm trying to program a counter from 000 to 999 seconds.

You never use A6.

Pin A6 is for a button that I added, but in the program that I showed I was only trying to display the numbers on the displays.

Why latching after every shiftout?

tank you for the awnser. It is the last test I was doing, I understand that latching after every shiftout is not necessary, but I wanted to find out if that could eliminate the flickering that was causing me problems.

Absolutely no reason, except that is the way the OP did it in his code, and it has no effect.

yup youre rigth, It is the last test I was doing, I understand that latching after every shiftout is not necessary, but I wanted to find out if that could eliminate the flickering that was causing me problems.

#define SER A0    //data
#define RCLK PE1  // LATCH
#define SRCLK A1  //            CLOCK
//#define Btn A6
uint8_t display[] = { B11111001, B11000000, B10110101, B11100101, B11001100, B01101101, B01111101, B11000001, B11111101, B11001101 };
int i = 0, j = 0, k = 0, l = 0;

unsigned long tiempoAnterior = 0;
unsigned long tiempoActual = 0;

void setup() {
  pinMode(SER, OUTPUT);
  pinMode(RCLK, OUTPUT);
  pinMode(SRCLK, OUTPUT);

  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  shiftOut(SER, SRCLK, MSBFIRST, display[0]);
  digitalWrite(RCLK, LOW);
  digitalWrite(RCLK, HIGH);
}

void loop() {
  tiempoActual = millis();
  if ((tiempoActual - tiempoAnterior) > 100) {
    carga(i, j, k);
    i++;
    if (i > 9) {
      i = 0;
      j++;
    }
    if (j > 9) {
      j = 0;
      k++;
      if (k > 9) {
        i = 0;
        j = 0;
        k = 0;
      }
    }
    tiempoAnterior = millis();
  }
}

int carga(int digito1, int digito2, int digito3) {
  digitalWrite(RCLK, LOW);
  shiftOut(SER, SRCLK, MSBFIRST, display[i]);
  shiftOut(SER, SRCLK, MSBFIRST, display[j]);
  shiftOut(SER, SRCLK, MSBFIRST, display[k]);
  digitalWrite(RCLK, HIGH);
  delay(50);
}

this is the program that im uploading, tank you for yor help.

There is something vital you have not told us.
What Arduino are you using? It is not a Uno, so without telling us what it is we can't help any more.

As to your schematic:-

Sorry not good enough. As schematic is exactly which pin goes with which pin. Otherwise there is no point. You need pin numbers on every rectangle as well.

It does not even include an Arduino, nether does it show any method of powering and where all the ground connections go.

Basically your problem is down the the fact that your data latch is not actually having any effect. In other words what you think of as a latch is not acting as a latch. That would cause the effect you describe. But you schematic does not give the information we need to be able say if this is the problem and more importantly, what the cure is.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.