Help needed with shift registers

No you was right! The latch pin should be low so no data will be send to the outputs. If i put the resistor on 5v and the latch then the latch will be high, if i tie it to GND then it is low(atleast it's working if i put the resistor between latch and ground). However i'm not sure if I need to place a resistor on every latch pin or only 1 resistor from latch to ground will be good enough (notice that all the latches from the 6 registers are tied together).

One resistor should suffice for all the registers.

Ok thank you very much :)! Then i put around a 10k resistor between the latch and gnd on my 5x5x5 cube.

Did some testing with 2 different codes today(changed the code in something easier for the forum):

1:

void loop(){
shiftOut(dataPin, clockPin, MSBFIRST, B00001);
digitalWrite(latchPin, HIGH);
delay(500);
digitalWrite(latchPin, LOW); 
}

2:

void loop(){
shiftOut(dataPin, clockPin, MSBFIRST, B00001);
digitalWrite(latchPin, HIGH);
digitalWrite(latchPin, LOW);
delay(500);
}

As you can see the difference is the place of the delay(). I uploaded both codes, and both looks exactly the same, so i can assume it does not care where i place the delay?

]

That's a rather strange way of ordering the events!

The sequence is:

Latch low
Data out
Latch high.

If you want to add a delay it should ideally be outside this sequence.

Then I will use your sequence, after all it looks like the best sequence out of the three i can choose. Thanks again!

So i got my cube working and all :). Only thing is that i still get a really faint flash on all leds (pretty hard to see because its maybe on for a millisecond or so). I tried lowering my pull down resistor to 3k but i still see the flashes. Maybe someone know why I still get flashes??

WonderTiger:
So i got my cube working and all :). Only thing is that i still get a really faint flash on all leds (pretty hard to see because its maybe on for a millisecond or so). I tried lowering my pull down resistor to 3k but i still see the flashes. Maybe someone know why I still get flashes??

I suspect it's the way you are managing the latching sequence Vs level enabling, but just a guess. You should enable a level only after all the shifting of data for that level is done and the latch set to output the value, only then should you enable that level for the time duration you have set for your scan timing, then disable that level, do the shifting/latching for the next level and then enable that next level. Lather, rinse, repeat.

Lefty

The problem is not with latching data out, but the leds are flashing when i connect my arduino to my laptop via usb (so when the arduino gets powered up). So im already using a pull down resistor on the latch I get significant less flashing on powering up. However its not completely gone(like 1ms flash or so).

Have you considered a pullup on the shift register's OE pin, and have your sketch pull it low when you're ready for output to begin showing up?

Im going to try a 10k from OE to 5V and see if that works, ill report back!

Btw, i wrote a piece of code in the void setup to put all latches to low and shift out B00000 (each zero is a LED in off state) to all shift registers

So I tryed it on a single shift register but no luck, its still flashing when getting powered up. However when I put a 10k resistor on the latch to ground on a single shift register on my breadboard it won't flash at all, but on my cube with 6 registers it will flash when using a 10k pull down resistor.

Well, 10K is only 0.5mA of pulldown - you could go stronger, like 1K for 5mA of pulldown. Arduino will drive it high okay.

So I tried 1k, still some very faint flashes on powering up :frowning:

Got it fixed, I was so stupid to shift out B00001 instead of B00000 at the void setup(I shift out B00000 to clear out all the shift registers). So I got it fixed :)!

Cool.

Ok...Another question. For now I have my Master Reset/Reclear tied to 5v. However I want to control the MR.
Now is it right when I pull the MR to LOW that all the shift registers will be cleared, and the bytes that were in the shift registers are gone(even when I set it to HIGH again)?

Ok, pull MR high with 10K resistor, have your sketch pull it low when you want to clear the input register.
Outputs will go low on the next rising edge of the output register clock; See the final RCLK on the diagram on page 4.

74hc595_TI.pdf (915 KB)

Thanks! Thats exactly what I was looking for. This is faster and easier then writing 0's to the shift registers.