You are in:  Design Ideas |


Drive 12 LEDs with one I/O line

Electronic News
Monday 08 February 2010 12:00

This Circuit Design idea uses a binary counter to generate LED-lighting codes. Charaf Laissoub, Maisons Alfort, France; Edited by Martin Rowe and Fran Granville - EDN

Several Design Ideas expand the I/O of a pin-limited microcontroller (reference 1 through 4, see below). The circuit in this Design Idea uses an alternative method (Figure 1).

It limits external additional parts to one IC, and it drives as many as 12 LEDs in dot-bar or bar-graph mode. You can use the same technique in a dot-bar design (Figure 2).

See all Circuit Design Ideas

If you need a seven-segment LED display, you can use the circuit in Figure 3, which shows how to rearrange the circuit according to a classic multiplexed, four-digit common-cathode display.

The prototype display uses Kingbright's SC52-11EWA high-efficiency LEDs, which emit 2000 to 5600 µcd at a forward current of 10 mA. The driver is a 12-stage NXP 74HCT4040 binary counter or a 74HC4040 version for a lower power supply.

Listing 1 contains an assembly-language routine. It generates a precise quantity, Q, of high-frequency pulses, which deliver the number, N, that the outputs of the 74HCT4040 require.

The relations are Q=2N-1 in dot-bar mode and Q=2N-1 in bar-graph mode. Listing 2 is a full example of using this routine with Microchip's PIC10F202, a member of the PIC10F series, which is the company's most pin-limited microcontroller family.

Although the PIC's internal unique clock frequency is 4 MHz, you'll notice little flicker effect. You can reduce the flicker by using a midrange pin-limited PIC microcontroller, such as the PIC12F629, which has an internal clock frequency of 20 MHz.

Listing 3 uses a look-up table to convert the desired number into seven-segment code to replace the 12 LEDs with a four-digit display.


References
  1. Anonymous, "Microcontroller provides low-cost analog-to-digital conversion, drives seven-segment displays," EDN, May 10, 2007, pg 80.
  2. Raynus, Abel, "Squeeze extra outputs from a pin-limited microcontroller," EDN, Aug 4, 2005, pg 96.
  3. Jayapal, R, PhD, "Microcontroller's single I/O-port line drives a bar-graph display," EDN, July 6, 2006, p 90.
  4. Lekic, Nedjeljko, and Zoran Mijanovic, "Three microcontroller ports drive 12 LEDs," EDN, Dec 15, 2006, pg 67.

Recommend this article

View the ElectronicsWeekly.com topic zones:

Electronics Weekly Zone - PowerElectronics Weekly Zone - Test & Measurement


 

Sign-up for the ElectronicsWeekly.com newsletters:

Electronics Weekly newsletters - Sign up for Made By Monkeys, Mannerisms, Gadget Freak and Daily and Monthly newsletters

Related Jobs

Resources

Related Articles

Job Opportunities