Latest News
|NewsletterAbel Raynus, Armatron International, Malden, MA; Edited by Charles H Small and Fran Granville - EDN, 1/5/2008
The moving-dot display has some benefits over the bar-graph display: It better indicates the location of a detected object in sonar and radar applications; it needs only one LED’s current-limiting resistor instead of several; and it provides the same current for all LEDs, thus providing even brightness.
When a new design required adding a seven-LED moving-dot display to an 8-bit, low-end microcontroller, a question arose about the corresponding interface. Of course, the most cost-effective approach is to directly connect the LEDs without any extra parts. But this approach needs seven vacant microcontroller-output pins, which microcontrollers with limited I/Os often cannot afford.
A previous Design Idea describes a one-wire interface that applies only to a bar-graph display, not to a dot display (Reference 1). Another tack would be interfacing using serial-to-parallel shift registers or a serial-input Johnson counter. But small microcontrollers often lack a SPI (serial-peripheral interface), and you must use firmware to re-create it (Reference 2).
The method in this Design Idea needs three output lines—data, clock, and latch—and requires some firmware and hardware. Exploiting the fact that only one LED in a dot display should light at a time, you can use National Semiconductor’s CD4051 1-to-8 analog demultiplexer (Figure 1). This circuit needs three microcontroller outputs, and the firmware is simple and straightforward. The additional benefit is that the microcontroller now does not limit the LED current and voltage; you can choose them independently.
Listing 1 provides demo firmware illustrating this design. The demo program automatically moves the lit dot back and forth by incrementing and decrementing a modulo-7 counter. Ideally, any three adjacent microcontroller outputs, such as pA0, pA1, and pA2, are available for the A, B, and C inputs of the CD4051. But, this scenario is not always possible.
In this application of a low-end, eight-pin MC68HC908QT1 microcontroller, you can use pins pA2 and pA3 only as inputs. You can easily overcome this problem by programming, as Listing 1 shows. This Design Idea applies to any small microcontroller because it uses only a standard instruction set.