Software PWM using daisy chained 74HC595s / SPI

Actually I think you may get away with using this with no modification to the 8 bit vs 4 bit. The cheep and easy route may be to just cut the number you use in the SR_COUNT variable in 1/2. So in your case if you have 8 shift registers cascaded, you would set SR_COUNT to 4 to equal the same number of pins.

Try that first and see if everything else just works for you (it may).

The reason is because you will most likely end up wanting to combine 4 bits of data together in pairs to equal a byte, but having a even number of 4 bit SRs makes it work just like an 8 bit SR.

Someone chime in here if I am bass ackward on this one please.

Cheers