spcomputing

CodeBecause it is so much easier to use a lot of these now, we wanted the code to be the same. So we made an Arduino library that is capable of controlling near 2000 of these chained together and still enable you to call each pin individually. (this library can be used with the plain 74hc959[typo - spc] chip as well)

Another alternative along the same lines as the 74HC595, if you need to have higher power switched than a standard 595 can do for you, the TPIC595B can be used which can switch 150mA per pin (as a GND/drain rather than a source of 5V). I've used a pair of those cascaded to switch segments of 12V LED strip lighting.

Cheers ! Geoff

"There is no problem so bad you can't make it worse" - retired astronaut Chris Hadfield

In addition to the inconsistancies Mike has asked for clarifications on...

Quote

I knew that I can stack more 595, but it'll need me to do Shiftout more then once.

If you have a concern for how many times shiftout() is called, in the configuration you propose you'll actually be calling shiftout() up to 8 times more than with a 595 cascaded alternative. This is because for each individual pin you update you're setting the addresses in parallel on all of the 4051's but only enabling one for output, so you'll need to send that 595 a different bit pattern to update each pin on each 4051. In contrast, with 3x cascaded 595s, you would need to output just 3 bytes via only 3 calls to shiftout() rather than the 24 needed to do the same in your proposed configuration.