This Design Idea (Figure 1) 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 [1-4] . A Some other Design Ideas 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).
Table 1. LED drive logic table. Avoid (0,0) and (1,1).
For testing, a PIC10F200 and PIC10F322 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:
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.
Source Codes (assembler) - download
News on theme: