I've seen a lot of information on how to use shift registers to control multiple outputs, but all of the examples I've seen presuppose that you are controlling the maximum number of outputs that a particular shift register can handle. I'm confused as to how to handle a situation where I want to control less than eight outputs.
Specifically, I have an idea for a dice roller. The concept is that after generating a random number, the code would transmute that into a seven-digit binary number to reflect the LED "pips" which should be turned on, based on the physical location of pips on an actual die (i.e., for each digit, 1 would mean that the appropriately numbered pip would be on, 0 would be off). I would then pass that number to the SR, which in turn would control the seven LED pips.
Since the shift register expects eight bits of data, I assume that I actually have to pass it an eight-digit binary number, with either the first or the last digit always 0. I assume that somehow, whether the first or the last digit is always zero is related to whether I use MSBFIRST or LSBFIRST in the shiftout command, and is also related to which data pin (0 or 7) is left unconnected. However, I am totally confused as to how this all fits together (i.e., which digit do I set to zero, which pin do I leave unconnected, and do I use MSBFIRST or LSBFIRST).
Any suggestions which would help me understand this would be appreciated.
Thanks.
Rob Rothman