Tuesday, November 10, 2015

Playing night rider with three 74HC595s

Connected three 74HC595s in series and entertained myself by simulating KITT from Knightrider.  Would have hooked up the fourth one but was running out of realestate and LEDs.  I should have a another breadboard in a few days along with some 7 segment leds that I will be hooking up and controlling with the 74HC595s.
NOTE:  The breadboarding of 4 seven-segment displays and driving them with the 74HC595's is an exercise in digital electronics and programming not meant to be a recommendation for implementation in an actual project.  If you need a 7 segment display in your project I recommend using I2C like I am doing in this photo using the Adafruit 0.56 4-digit 7-Segment Display w/I2C backpack (assembly with soldering required).



Till then, enjoy the video and code.

UPDATE - Found that with zero delay the data is getting clocked to the registers at 58KHz.  I thought it would be faster but then if you divide 58Khz into the 16MHz clock of the arduino you get 275 (275 machine cycles). That means it takes the Arduino 17 microseconds to complete the loop when there is no delay.  Looking at the code it is hard to believe 275 machines cycles are required to prepare the next unsigned long integer to be shifted out then clock it out, but I do not know how many of those are used up by the ShiftOut() library function that is called three tiems to shift out all 24 bits.




SourceCode on GitHub

No comments:

Post a Comment