AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
I'll check the data sheet on the 595 to see if it can sink the current of all seven segments being on at once. Number = 9999 // Do some bounds checks to avoid strangenessĭ1 = (int) (number / 1000) // Get thousandsĭ2 = (int) (number / 100) // Get hundredsĭisplayADigit(disp1,byte(SevenSeg)) // Show thousandsĭisplayADigit(disp2,byte(SevenSeg)) // Show hundredsĭisplayADigit(disp3,byte(SevenSeg)) // Show tensĭisplayADigit(disp4,byte(SevenSeg)) // Show units Pin connected to Data in (SER,14) of 74HC595Ĭonst int disp1 = 7 // Displays are numbered from left to rightĬonst int disp2 = 6 // as disp1 to disp4.Ĭonst int disp3 = 5 // Scan displays quickly and use POV to displayĬonst int disp4 = 4 // 4 digits with only 1 shift register Pin connected to clock pin (SRCLK,11) of 74HC595 Pin connected to latch pin (RCLK,12) of 74HC595 Qa to Qf to the anode segments of the LED display. Connect the collector of the transistor to the cathode ofīe sure to use current limiting resistors from the shift register outputs Wire the emitter of the NPN transistor to ground.Ĭonnect the Arduino digital pin to the base of the transistor via aġ k-ohm resistor so as not to provide excessive base drive and damage See Arduino ShiftOut tutorial for more info: Īrduino digital pins 4 to 7 drive the cathode for digits 1 through 4.ĭigit 1 is the leftmost. The 74HC595 shift register attaches to pins 8, 11 and 12 of Arduino. Here is the code:Įxample code for driving a 4 digit common cathode 7-segment display withĪ 74HC595 8-bit shift register and 4 NPN transistors. The next step is to attach the DS1307 and turn the display into yet-another-arduino-clock. Not much really but I had a lot of fun making it and learned a lot about Arduino in the process. The sketch just counts from 0 to 9999 and then starts over. Specific details are in the code comments. Next I wired in the cathode drivers by driving each one with a 2N3904 transistor so as to not overload the Arduino pins. Similarly, connect each of the 'b' thought 'h' segments of the display to each other and to the corresponding pin on the shift register. See the great tutorial elsewhere on this site. I connected all the 'a' segments of each display to each other and then connected that to the QA output of the shift register. I went for a multiplexed approach with a single shift register driving the segments (anodes) and 4 digital i/o pins each driving a NPN transistor to switch in each cathode one at a time. Similar projects used a 75HC595 for each digit. The result is a 4 digit counter I made from a pair of 2 digit common cathode 7-segment displays. As I hadn't seen anything similar to my approach I thought I would post my results to share with others. I'm a new Arduino user (convert?) and wanted to do something simple for my first project.
0 Comments
Read More
Leave a Reply. |