This is now straying from what's immediately possible with the ARDX starter kit. The 8bit register example mentions that you can chain them together for however many bits as you want.
So I went out and bought another 8bit shift register, and a 10LED bargraph. So after reading wikipedia I tried putting together a 16bit shift register by chaining the two 8 bits together.
It's actually pretty simple to wire up. The input data for the second simply comes from the last digit out of the first. all the other controllers and grounds etc. are exactly the same.
Why is this useful? Well. This still only uses 3 arduino pins to control the data. In principle I can add another 8bits with another chip and have a 24bit register, and so on ad infinitum..
The tricky bit is breaking down the bits into 8bit chunks. then sending them in the right order during the set signal. This basically means sending the highest 8 bits, then he lower 8bits. I tried sending a word directly and it didn't seem to work, so it took:
shiftOut(data, clock, MSBFIRST, (int)highByte(state));
shiftOut(data, clock, MSBFIRST, (int)lowByte(state));
Overall this little configuration is a pretty handle little setup. The ability to set up a bargraph on just 3 pins is pretty useful, so I am thinking of soldering up a circuit like this as my first custom arduino shield, as this would be pretty handy for prototype meter circuits. The only bit which is a shame is that the bargraph is 10 leds, and I have 16 bits, so it feels like I'm wasting the extra 6 bits I have. I might look at getting a 16bar if possible, or maybe add 10 green, 6 red to indicate high or something.
cool man... i had the 8bit working flawlessly in a POV display... tried to extend it to 16 bits but couldn't get it to work exactly right... I think the problem is similar to what you first encoutered --> have to split into a highByte/lowByte cuz the shiftOut function is made for 8bits...
horlacsd 1 year ago