- Discrete LEDs
- Dot/Bar LEDs
- Matrix LEDs
- 7-Seg LEDs
- Serial -- Software
- Serial -- Hardware
- RS-232 via the MAX3232
- I2C -- EEPROM
- I2C -- DS1307 Real Time Clock
- 1-Wire -- DS18B20, Powered, Single-Drop
- 1-Wire -- DS18B20, Powered, Multi-Drop
- 1-Wire -- DS18B20, Parasitic, Multi-Drop
- TI Link Protocol -- Calculator Demo
- Infrared Communication
- MIDI -- Output Demo
- MIDI -- Input Demo
- MIDI to Analog Synth
7-Segment Display -- Four Digits
It's an easy jump from multiplexing two digits to four digits. Instead of discrete transistor current sinks, we'll use the ULN2003A chip which contains seven Darlington pairs (of which only five are needed).
Port B drives the seven anodes, while Port A controls the five current sinks.
This particular LED display is already internally wired for multiplexing, including the colon, and sits on standard 14-pin DIP pins. So it's mechanically very easy to mount and wire up. I believe I bought mine from SparkFun if I recall aright.
There's nothing startling in the source code. As usual, we'll store the segment patterns in a constant array and access them via indexing. The multiplexing is driven by interrupts which occur at a rate of about 61 Hz. That's sort of pushing it from a flicker-point of view, but I didn't notice any in this particular device.
Click to get the source code.
Click to get the schematic PDF.
Next Project: 7-Segment Display -- Eight Digits