This Design Idea demonstrates a new method of driving six LEDs with only two I/O lines from a microcontroller, and so is particularly suitable for any pin-limited chip. It uses a pair of I/O lines combined with a pair of complementary bipolar transistors.More than one LED can appear to be lit by multiplexing.
A previous Design Idea [1] shows how to drive four LEDs with two I/O lines. Some other Design Ideas [2-5] use additional logic, which increases cost and size.
Note that VDD must be between 2V & 3V: for example, if LED2 is ON (Table 1), LED4 and LED6 will also light if VDD is too high. You can choose any general purpose low power transistors, but to keep the same brightness for each LED, choose transistors with low VCE(sat).
For testing, a PIC10F200 was chosen as it is the smallest and simplest 6-pin microcontroller. For pedagogical purposes, the firmware has been provided as two separate and simple assembler sources:
dotmode1.asm acts as a free running dot chaser.
barmode1.asm displays an incremental bargraph.
(Download DI5459PIC2IO6LED.zip.txt by choosing Save As and removing the dummy “.txt”)
Note that in either mode, only one LED is driven at a time, with a minimum amount of current (down to 2mA with high brightness LEDs), and uses periodic bursts of short pulses. The assembler sources are fully commented, optimized in size, and take less than 256 words, allowing the user to choose any other pin-limited PIC.
For more detail: Two PIC pins drive six LEDs