| Electronics > Beginners |
| Can I multiplex a 2-digit 7-segment display one segment at a time? |
| (1/7) > >> |
| Peabody:
I'm working on a project which will display a duty cycle percentage from 00 to 99, using two 7-segment common cathode digits. I have enough IO lines for the seven segments and two cathode drives, and had planned to multiplex the two digits in the usual way. That would require 7 resistors for the segments as well as an NPN transistor and base resistor on each cathode. I'll use an MSP430 MCU, and the code will be written in assembler. So it occurred to me that the code would be simple enough to fire each of the 14 segments one at a time. Since only one segment would ever be on at a time, that would let me replace the 7 anode resistors and the cathode transistors with just one resistor on each cathode. But of course that would mean that the average brightness would be pretty low, and the effective refresh rate for an individual segment pretty low as well. Tentatively, the background refresh rate is 488 Hz, which would refresh each segment at about 35 Hz, but I could speed that up if necessary. This would be great for the parts count, but I suspect this may be a bridge too far. Has anyone here ever tried something like this, even with one digit? Can I test the brightness issue by multiplying the resistor by 14 and seeing if the segment is still visible? That would be 6.8K instead of 470 ohms. Or is that not really equivalent to 470 ohms 1/14 of the time? Seems like it might not even turn on using 6.8K. And this is all 3.3V by the way. The other potential complication is that if this thing works, it will probably be redone using an Arduino, and I'm not sure the efficient assembler code could be duplicated in C. Still, it would be nice to do without all those resistors and transistors. What do you think? |
| ogden:
--- Quote from: Peabody on December 01, 2018, 06:22:19 pm ---I'll use an MSP430 MCU, and the code will be written in assembler. So it occurred to me that the code would be simple enough to fire each of the 14 segments one at a time. Since only one segment would ever be on at a time, that would let me replace the 7 anode resistors and the cathode transistors with just one resistor on each cathode. --- End quote --- This is not where you save on code simplicity. Look at segment multiplex as PWM. For 7 segments it (on/off) is at 1:7 rate, for 14 segments accordingly 1:14. Blinking will be more noticeable and it will be twice as dim. |
| Nusa:
(For real fun, look up charlieplexing. Sadly, that doesn't work so well when individual led's are tied to common cathodes.) First off, how many I/O lines do you actually have for this purpose? If it's 14 or more, you don't even have to multiplex. Second, realize the sizing of resistors in the circuit needs to change with the duty cycle, except when the goal is to dim the display. If the duty cycle is low enough, you may not need resistors at all! Third, while assembly is less portable than C, C is usually just as efficient when done right. Whether it's portable will depend more on the compatibility of assumptions you made about the hardware than anything else. |
| Peabody:
--- Quote from: Nusa on December 01, 2018, 06:55:35 pm ---(For real fun, look up charlieplexing. Sadly, that doesn't work so well when individual led's are tied to common cathodes.) First off, how many I/O lines do you actually have for this purpose? If it's 14 or more, you don't even have to multiplex. Second, realize the sizing of resistors in the circuit needs to change with the duty cycle, except when the goal is to dim the display. If the duty cycle is low enough, you may not need resistors at all! Third, while assembly is less portable than C, C is usually just as efficient when done right. Whether it's portable will depend more on the compatibility of assumptions you made about the hardware than anything else. --- End quote --- I did look at some videos on charlieplexing, but they all related to individual LEDs. I didn't see anything related to 7-segment displays. With 7 + 2 I/O lines assigned to the display, I have one pin left over. It's a 20-pin MCU, with 16 I/O pins, but I also have a rotary encoder, a momentary switch, an LED, a buzzer, and an SSR trigger. So I don't have another 7 pins for the display. I had forgotten that the resistors could be much lower value, and the current much higher, for brief periods of time. And the point here is not so much to save on power but rather to save on parts. So if it's not too blinky, this may actually work. I think it's at least worth writing some code to test it. But between the MSP430G2553 processor and the TDSR1350 digits, I'm still looking at something under 10ma. That's common anode, isn't it, not common cathode. Sorry, I misremembered that. My comment on Arduino was just based on my experience with others who use them a lot. I don't see much bit-wise activity in their code, and it appears that a main focus of Arduino is to separate you as much as possible from the actual registers. Assembler, for me at least, is the opposite of that on both counts. In my code for this, there will be no MAIN other than to set up the interrupt, then go to sleep. Everything will happen in the interrupt service routine, and the processor will sleep in between. I don't see that kind of stuff in Arduino sketches. But of course that doesn't mean it can't be done. |
| mikerj:
--- Quote from: Peabody on December 01, 2018, 10:15:26 pm --- I did look at some videos on charlieplexing, but they all related to individual LEDs. I didn't see anything related to 7-segment displays. --- End quote --- A forum member, matseng posted an instructable that permits a level of charliplexing on 7 segment displays, 9 pins will allow you to drive up to 8 digits at the cost of some code complexity. This isn't very useful if you are only driving two digits, but worth remembering. If you need to save pins then you could drive the displays with a couple of shift registers. |
| Navigation |
| Message Index |
| Next page |