Hello,
I am trying to interface a 595 shift register to drive a 7 segment display as part of my groups senior project. Our goal is to cascade three shift registers together to make a 3 digit display. We are going to take body measurements for heartrate and body temperature (and time permitting blood pressure) and display them on the 7 segments. This means that we will have to drive four, three digit displays. Is it possible to drive up to four displays using what I have with the dragon board? I have been working on some code for it but am very unsure of the direction I should be taking. I have been studying the SPI port because that seems to be the way to drive it. I am using the MC9S12DG256, hcs912 based board. Here is the code from my main program:
I have included a zipped file with all my work including all my functions, datasheets for the shift register and 7 segment display. Please take a look, right now I have no guidance software wise on how to do this and will greatly appreciate any help that I can get.
Hello, and welcome to the forum.
Firstly, your choice of a large format, 7-segment LED display type will create considerable interface difficulties, to the extent that you would need to use special high voltage interface devices, in addition to the shift registers. This is because the displays you have chosen have four series connected diodes for each segment, resulting in a maximum voltage drop requirement of 10 volts (8.4 volts typical). The supply voltage to these displays will need to be considerably greater than the maximum drop, especially if using series resistors to limit segment current.
To simplify the college project, I suggest that you use a smaller LED display type, with only a single LED per segment, so that a 5 volt supply may be used for the display. If directly driving each segment from the 595 output, you would need to limit to about 5 mA per segment using a series resistor for each segment.
Since you would need a separate 595 device for each display, making a total of 12 packages, and 96 resistors, you may also wish to consider other approaches that result in less additional hardware. Special multiplexed LED driver packages are available. One that comes to mind is the Maxim MAX7219/MAX7221 type. Each package is capable of handling up to eight digits, and is SPI compatible. You would need two packages for the current project, and a total of two resistors to set the segment current.
Should you decide to stay with using the 595 devices, you will need to decide whether you handle the update data for twelve digits as a single 12-byte sequence, or as four separate 3-byte sequences (i.e. updating one 3-digit display at a time). In the first case you would need a single strobe output to pin 12 of all packages, connected in parallel. For the second alternative, there would need to be a separate strobe output to each 3-digit group. The strobe pulse(s) would be generated by your code at the completion of each data sequence.
I am unclear as to the operation of your disp_tab[][] two-dimensional array. Are the 595 connections to each 7-segment display identical for each digit, or do the connections differ from digit to digit? Do the connections for each 3-digit display follow a simiar pattern? I might have expected one of the array dimensions to have a size of at least ten, to provide an index to all the numeric characters. You will likely also need to define a blank display state, and maybe you will also need to handle a limited range of alphabetic characters, or other symbols. These would require further positions within the table. I would assume that the DP state would be handled from outside the table.
For example, if there happened to be identical 595 connections to each digit, and you had four separate sequences of three digits, I might have expected a single dimension array to reflect the output pattern for each numeral. You would then successively send the output pattern corresponding to each of the three digits, either LSD or MSD first, depending on the 595 daisy-chaining sequence. Finally you would generate a short strobe pulse to update the output latches.
Regards,
Mac