I'm trying to teach myself electronics and my goal is to create a digital clock with 4 digits.
I have an MSP430G2231 which has only 8 available ports as far as I can tell.
I saw some methods for driving multiple seven segment displays, like using a multiplexer or transistors. But it doesn't seem possible with MSP430G2231 because of it's lack of ports.
Am I wrong? Or could it be done? If yes, how?
Answer
Like Leon says you can use an I/O expander, or even better a LED display driver. In the past I've used the MAX7219, but this is a 5V device, for 3.3V you have to go to MAX6950. This can drive up to five 7-segment digits (the 6951 can do 8), so that may be suitable for your clock. It's controlled via SPI, so you only need 3 I/O pin of your controller. The driver does the multiplexing for you, has a BCD to 7-segment decoder and you can control brightness via software. One minor issue may be the package. The 7219 was available in DIL, but the 6950 only comes in a 0.635 mm pitch TSOP.
You say you don't want a crystal (why not?). For a clock you normally would use a crystal to get the required accuracy. But you can also work with the mains frequency, which over long term like months is even more accurate.
edit
Leon rightly remarks on the high price for the MAX6950. The MAX7219 is more affordable, but like I said it's a 5V device. Since you only need 3 lines to drive it you could easily add a few level shifters. A transistor will suffice, at least if you don't mind bit-banging the SPI (because it inverts the signal). If you want to use the on-chip SPI you need a non-inverting level shifter, like the FXL4T245 (difficult package though).
Alternatively, just buy an MSP430 with more I/O pins :-)
No comments:
Post a Comment