LED Dot Graph -- Direct Drive


Let's leave individual LEDs behind us now and move on to multiple displays. To get started we'll investigate how to do dot and bar graphs with the typical ten-element LED display like you see in the picture here. There are a number of ways to deal with this part. Here's the simplest approach, each element is driven by a separate port pin. Simple yes, but certainly pin-hungry. Still, a good way to begin. Take a look at the schematic.


Since this is a dot graph, only one element is lit at a time. Hence, we can get by with a single current-limiting resistor. All of the cathodes are ganged together through it. When the circuit is running, the dots sweep back and forth in a pleasing fashion.

The source code is eminently straightforward. But notice how the ten elements are allocated, eight of them on Port B, the remaining two on Port A. Splitting up bytes and words in this fashion is quite pleasant in PIC Micro Basic; there are a number of easy-to-use commands available for doing so. In this case, I've used the hi() and lo() functions with a word variable.

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

Notice that this same circuit is also used for the bar graph in Exercise 019. Still, a single LED element is lit at any given moment, but due to the rapid multiplexing there, to the eye it seems as though a bunch are on all at the same time

Next Project: LED Dot Graph -- with CMOS Decoder

No comments:

Post a Comment