4 shift registers

PaulS:
They aren’t. But neither example reflects what OP is actually doing, with regards to when the latch pin state is changed.

What I’m actually trying to do is, to control an RGB-matrix with 74HC595 shift registers. I thought it was as simple as just sending some bits like they told me in the example on the arduino website.

I thought it was as simple as just sending some bits like they told me in the example on the arduino website.

It is.

But, you must send the 32 bits between toggling the latch pin. What you are doing now is toggling the pin between each group of 8 bits.

PaulS: But, you must send the 32 bits between toggling the latch pin. What you are doing now is toggling the pin between each group of 8 bits.

No, that is not correct.

Op's code:

    digitalWrite(latchPin, LOW);
    shiftOut(dataPin, clockPin, MSBFIRST, dataCA);
    shiftOut(dataPin, clockPin, MSBFIRST, dataGREEN);
    shiftOut(dataPin, clockPin, MSBFIRST, dataBLUE);
    shiftOut(dataPin, clockPin, MSBFIRST, dataRED);
    digitalWrite(latchPin, HIGH);

That shifts out 4 x 8-bit values then raises latchPin. The 74HC595 is +ve edge triggered. [u]That is correct.[/u]

Nielska: the bits I send through the shift registers don't go further then the second shift register.

You must have a hardware fault between the second and third shift register. Check your wiring.

Yours, TonyWilk

TonyWilk: You must have a hardware fault between the second and third shift register. Check your wiring.

Seconded. The data pins should be daisy-chained, the latch output should just go to all 4 chips as-is. But if you have 2 working, then you already know that. Youre looking for some bad soldering. What happens when you take the data output from the arduino off the first chip and just put it on the second chip? Do 16 bits go through and then stop, or do only 8 go through?

Hi,

Can you please post a copy of your circuit, in CAD or a picture of a hand drawn circuit in jpg, png? Not a picture of the layout, the one you have supplied does not identify pinouts, and you can't even read component numbers.

Please label pinouts and component numbers. Include you power supply and how it supplies the LEDs and UNO.

Thanks.. Tom... :)

PaulMurrayCbr: Seconded. The data pins should be daisy-chained, the latch output should just go to all 4 chips as-is. But if you have 2 working, then you already know that. Youre looking for some bad soldering. What happens when you take the data output from the arduino off the first chip and just put it on the second chip? Do 16 bits go through and then stop, or do only 8 go through?

Only 8 go through.

I’ve made a circuit in Multisim, I als spit it op in parts so it’s less chaotic. I took a picture of the outputs and the pins that go the he shift registers.

ToShiftRegisters.PNG

Nielska: I've made a circuit in Multisim snip

That looks ok to me.

It must be something in the wiring... if you have a multimeter, check continuity from the Arduino pins for each common line (masterClear, clockPin, latchPin and outputEnable ) to all the shift registers Check each shift register's pin 9 out to the next pin 14 in. Do they all have +5V and GND connected ?

If you have LEDs plugged in each of those headers, I guess the RED ones work... could you plug the RED LEDs into the BLUE or GREEN socket? It could be those other LEDs are not wired correctly.

Yours, TonyWilk

Hi, Can you post a higher resolution image of your schematics please? It is not possible to read pin designators.

What will you be doing with CA output header?

Have you got this breadboarded and using a UNO, or a 328 chip and PCB?

Can you post a picture of your project please?

Thanks.. Tom.. :)

Nielska: Only 8 go through.

Well, there you go then. Same code, it should be pushing out 16 if it was a bug in the code. Only 8 go through.

How about if you feed the bits into the third register? Do all 16 bits load into the 3rd and 4th? You have a wiring problem between the data out of the second register and the data in of the third.

Hi, This Library will probably make things easier.

  ShiftRegister74HC595.h - Library for easy control of the 74HC595 shift register.
  Created by Timo Denk (www.simsso.de), Nov 2014.
  Additional information are available on http://shiftregister.simsso.de/
  Released into the public domain.
*/

#include 

// create shift register object (number of shift registers, data pin, clock pin, latch pin)
ShiftRegister74HC595 sr (1, 0, 1, 2);

https://shiftregister.simsso.de/ Tom... :)

Well, this is something weird. I tried connecting the ‘green’ LED’s to the first register and they don’t light up.

Hi,
This diagram is weird, what are the green lines doing?
894c605e63d7eff0116c24409200589801ba2cea.png

Tom… :o

TomGeorge:
Hi,
This diagram is weird, what are the green lines doing?
894c605e63d7eff0116c24409200589801ba2cea.png

Tom… :o

I deleted the lined from the LEDs to the third shift regeister en connected them to the first shift register.

Hi,
Have you looked at my suggestion in post #17?

Have you written code just to get the first 595 connected and working?
Then added the next 595 connected and got that working.
Then added the next and the next, each time getting the code to work before continuing.

If not I suggest you do, so you can prove your code is working at each stage.

Tom… :slight_smile:

Nielska: Well, this is something weird. I tried connecting the 'green' LED's to the first register and they don't light up.

Ah, so the RED LED's did work when connected to the first shift register, but the GREEN ones don't ?

Since your code looks ok and the first shift register was working, it is possible that all the shift registers are working but the LEDs are not connected correctly.

Could be: a. the GND connection to the GREEN LED's b. the GREEN LEDs are the wrong way round

Try: unplug one green LED wire from the shift register and touch it to the 5V line - the LED should light, if not then check the GND connection, then try turning the LED round.

Yours, TonyWilk

Hi, Do you have a DMM?

Tom... :)

TomGeorge: Hi, Do you have a DMM?

Tom... :)

Yes

Hi.

Have you checked the 5V supply to ALL the 595s. Check for connectivity to the 595 pins, with the power OFF.

Does your protoboard have a break in the red/blue or red/black line down the side of the protoboard, ie the power bus lines?

Can you post a picture of your project please?

Thanks... Tom.. :)

It's fixed, apparently there is a broken connection in my breadboard. Thanks to all of you who were willing to help me.