I have 6 74HC595 Shift Registers daisy chained... Is that too many? It seems to be acting screwy. By "screwy" I mean it is not lighting the LEDs I would expect, when I would expect it to do so. Perhaps I am missing something code-wise? I have tested and verified the chips and connections individually, and all is well. Additionally, when the arduino 1st loads I have noticed that the intended LEDs flicker for a split second, then never come on again. OR after a reset the intended LEDs will come on if they are in registers 4, 5, or 6- but then they just stay on ignoring the ender(); function altogether.

Here is my debug code, to try to figure out what is going on:

Quote

constint data = 6; constint clock = 7;constint latch = 8;constint outputenable = 5; constint masterreset = 4;constbyte shiftoutarray[] = {0, 1, 2, 4, 8, 16, 32, 64, 128}; // NOTE: I only want to light one LED from any given register at a time, which is why these bytes are like thisconstint ON = HIGH;constint OFF = LOW;

I mess around with output enable because in my main project, should power loss occur this will help to keep my liquor pumps from arbitrarily spewing liquor when power returns. I just snagged this code section from the main project, and my arduino is still wired for the main project, so since I have a pull-up resistor on it I at least have to control it or it won't let anything out.

As far as the wiring... I don't have a diagram, it would take too long to create. What I have done is make sure all the registers work properly. I have went over their wiring 5 times now just to be extra sure they are wired up correctly. When I was daisy-chaining 3 of them it worked like a charm, but as soon as I added 3 more it's miss-behaving.

If I send out six bytes of 0XFF it lights up the furthest FIVE registers, but not the 1st one (closest in the chain to the arduino) Which makes no sense to me either- six bytes should hit all six registers! Even stranger still, if I send EIGHT bytes out, then all six registers light all of their LEDs to include register #1 (the one closest to the arduino)

Why would eight bytes be required to light up six registers? Should I put a slight delay between ShiftOut commands you think, so it can keep up or something?

Also, as noted above, I have decoupling 0.1uF capacitors plugged in just before each registers Vcc in. The caps are bridging Vcc and Gnd.

Here are a few pic of the full setup- it's difficult to see exactly what my wiring is doing in a picture, but I think the BarBot is getting pretty awesome!

The LEDs on the far left are standing in for three transistor array chips. I had to remove the chips once I discovered the shift registers acting funny- I put the LEDs in for ease of troubleshooting for now. The LEDs you see on the far right are RGB LEDs- they will be for effect lighting in the finished project. The switches will sit in the glass holsters to let the BarBot know if a glass is in place. That way it won't just pour booze on the counter In addition, if there is more than one shot glass present it will turn the wheel to the next present glass and repeat the recipe- up to five shots at a time!

Here is a close up shot so you can see (kinda) where I have my decoupling caps. The green leads (or in the case of register #1 and #3, yellow) right next to the caps are going to the chip's Vcc line.

All registers WILL work, but as stated before, not as expected. For example- this code WILL light all the register's LEDs, but not at first... it first lights the last five registers, then a minute later the first will light up. Also, if I then pass it

they won't turn off... they just stay on. OR if I try to just turn on ONE LED somewhere- no dice. It's weird, I'll see the correct one flicker for a split second right after loading the code, and again if I open the serial monitor, but thats it. Sometimes if I reset the arduino then the correct single LED will light, but once again it will not respond to shiftOut commands designed to shut it off again.

It's frustrating because with only 3 shift registers I had this thing running perfectly, and now I can't figure out whats wrong.

Anyways, here is the proof that the shift register WILL light everything up when passed the code above- so they ARE wired correctly enough to address all their outputs at least...

Since you're not showing a schematic, and the code looks ok, I would suggest moving the decoupling caps closer - like the hole right next to the vcc pin in the same row, not way off to the side where you have them now.Look at this board - I daisy chained two of them with 20 shift registers (open drain TPIC6B595 vs 74HC595) total and it worked perfectly.And it uses much higher speed SPI.transfer commands.

For LEDs which are relatively high current loads switched at logic speeds (5ns perhaps) I'd use 0.1uF + 10uF per chip, and 100uF+ for the whole board.

Switching many LEDs simultaneously could be causing a rate-of-change of supply current of the order of 10^8 amps/second,way beyond what a voltage regulator on a remote board can handle, so in a microsecond or so those 0.1uF capacitors aredrained and the circuit malfunctions - before the voltage regulator has time to adjust to the new load (which might take manyus).

The extra decoupling should hold the supply voltage up for long enough.

First I moved the caps much closer to the Vcc pins, and even shortened their leads since I read that is advisable.

That didn't fix it (although I'm sure it's good practice) but while doing it I noticed that when the arduino is reset, when it comes back online it shifts the last bit that it was given out to the registers.

This got me thinking... the problem must be with my latch! The fact that it shifts the last bit it had out means that the data and clock pins are doing what they should, but latch sure as hell isn't!

I started my 8th check of my connections, but this time I put special emphasis on checking the signal chain of latch- and I found it.

on the very last (6th) register, output enable was accidentally tied to latch :.

Apparently it just slipped into the wrong row as they are adjacent, and it can be difficult to see if you are not looking exactly for it.

I re-routed the OE to the row it should be in, and all is well again. Thank you to all who helped me find it- as by examining my code and telling me it wasn't the issue, and by letting me know that 6 shift registers are NOT too many, you got my mind focusing on the real problem.

I'm glad you got it working. Looking at your original photos, the most obvious problem to me is that each of your decoupling caps has quote a short path to the Vcc pin of the adjacent shift register but a *very* long path to the ground pin of that shift register. My suggestion would have been to add a short wire from each shift register ground pin to the ground side of the adjacent decoupling capacitor.

Formal verification of safety-critical software, software development, and electronic design and prototyping. See http://www.eschertech.com. Please do not ask for unpaid help via PM, use the forum.