16 bit counter flicker effect

Hi everyone! I have an on/off flicker effect on my 16 bit counter using 2 shift registers. The higher the counter goes the most significant bits are fading on and off at every single clock pulse (because they have to stay on for a very long time). Is there any way such that the left 8 bits could stay on and only the 8 bits on the right to get multiplexed?

Here’s my function code:

      void counter()
      {
       int i;
       int p=0;
       while(1)
       {
       for(i=0;i<255;i++)
      {
       digitalWrite(latchPin , LOW);
       shiftOut(dataPin, clockPin, LSBFIRST, i);
       shiftOut(dataPin, clockPin, LSBFIRST, p);
       digitalWrite(latchPin , HIGH);
       delay(displayDelay);
      }
      p=p+1;
      if(p==256)
      {
       p=0; 
      }
      }
      }

Also is there any problem with the code? Maybe a more efficient one?

Have you got any supply decoupling on those shift register?
You should have a 0.1uF ceramic between the power and ground of each chip.
Do you have a capacitor on the latch pin? If so remove it, that tutorial is wrong.

Is the last shift register getting hot?

Well, i use a 5v voltage regulator connected to a 9v battery. And i do not use any capacitor in the circuit at all, just at the regulator.
I don't even know what supply decoupling means :slight_smile:

And i do not use any capacitor in the circuit at all,

That will explain your problems then.

I don't even know what supply decoupling means

Then read:-
http://www.thebox.myzen.co.uk/Tutorial/De-coupling.html