How to Reset/Clear 74HC595 in Arduino Code

First time caller, love your show.

I am learning how to use an Arduino and 74HC595 shift-register. (Book: “Beginning Arduino”, McRoberts)

No problems with the book, just a curiosity question:

All the examples seem to assume that one loads 8-bits and then latches/sends out data to the pins (LEDs attached in my case) and then does it again. However, what if I want to just push out say three bits and then send the data out to the pins? Those bits seem to stay in the register and cause problems when I send the next group. I know that I can just feed the '595 8 bits at a time and go from there, but I am curious on how one might just load/store a few bits, send them (light some LEDs), reset/clear and go again.

After a lot of research, reading the data sheet for my '595 and futile attempts I am stumped. I have tried the notMR, notQE, etc. I am sure that it is something basic that I am missing but for the life of me, I can’t figure it out.

Any help would be appreciated.

Thanks.

Bringing /MR low while /OE is high should do it.

I don't know why you would bother. For (roughly) the same number of clock cycles you can clock out 8 bits.

Nick,

That did it. Thanks.

I just wanted to know how to reset things if needed.

But wouldn't this be necessary when you have these daisy-chained? If you have three daisy-chained and need to send the next "frame" wouldn't just "resetting" things and then pushing the next frame's bits be easier and faster?

Anyways, thanks again.

Not really, because even with 10 of them (like those scrolling LED signs) you generally want to refresh them all. So, you shift in x bytes where x is the number of 595 chips you have.

It’s not necessary to clear first, because pushing in the new bytes will push the old ones out the other end into oblivion. Then you latch afterwards, and they all change instantly.