How can I control an 8 x 8 matrix with 2 pcs of shift register?

Hi,
I am having problems when trying to light up the LEDs one by one in a 8 x8 LED matrix.
Can someone help me out? Here my situation is.

I use the first 74HC595 (call it SR#1) as row output control and the second one (SR#2) as column. In my circuit, SR#1 is sourcing while SR#2 is sinking.Both shift registers use the same RCLK and SRCLK inputs, and the serial data inputs are separate. Therefore, for example, if I needed to light the LED (0, 4) then the output of SR#1 would be 00000001 and SR#2 11101111.
However, after many attempts it still does not work. The LED bulbs did start scanning in order. If it wasn’t accompanied with other LED’s turning on.
Hopefully someone can help have a look at my code and find the bug(s).

shift_register595X2.ino.ino (2.52 KB)

Hopefully someone can help have a look at my code and find the bug(s).

Post your code according to forum guidelines and we will take a look. Also post a schematic diagram. We don’t want to waste our time fixing the code if the components are about to pop!

Problem solved. I read Carlyn Maw and Tom Igoe's tutorial again and located the problem in my code. The clock pulse must be after both data pins are written, while I put it before that.

Loveyoyodiudiu:
both data pins

Why do you have 2 data pins? Did you know you can daisy-chain '595 shift registers?

PaulRB:
Why do you have 2 data pins? Did you know you can daisy-chain '595 shift registers?

I use one shift register for row LEDs sourcing, and another one for column sinking. So that I need them output at the same time. I am a beginner and always try to find me myself an easy way. Thanks for your advice, the next the same project I would be happy to try with cascade.

Yes, you're right. One data pin works too. Another pin saved. :slight_smile: