7-Segment Display -- Latched


Multiplexing is a pretty cool trick, but unfortunately it can tie up quite a few software resources and eat into program space. So, here's an alternative approach using external CMOS latches which make the code trivial. The trade-off is the need for additional chips, but perhaps that makes sense for a given project.

We'll whip up a two digit display using a pair of CD4511 decoder/latches. As the name implies, they not only latch the current numeric data in place, but also handle the combinatorics of lighting the correct LED elements to create the digits 0 through 9. Moreover, these chips have enough oomph to drive the 7-segment displays directly; all you need are the usual current limiting resistors. The schematic requires two sheets:


Something else you might notice is the CD4001 configured as a pulse width modulator. This drives the enable pins of the latches and thus gives variable brightness depending on the duty cycle. I suppose this could have been handled by using the PIC's PWM and ADC modules, but to keep the software trivial, a bit of outboard hardware doesn't seem all that ungainly.

Incidentally, if any of this seems confusing to you, may I recommend Don Lancaster's classic, The CMOS Cookbook, which explains the ins and out of latches, pulse width modulation for LED fading and tons more.

Click to get the source code.
Click to get the schematic PDF.

Next Project: 7-Segment Display -- Serial

No comments:

Post a Comment