Background to the design of Complementary LED drive
Typically, each I/O drives or sources a single LED. To drive more than one, a high I/O count is required. In order to reduce I/O requirements, LED's are multiplexed in a matrix (as found on a keyboard). The complementary LED drive method proposes to implement even more LEDs while using fewer I/O. LEDs are polarized and can only operate when current flows from anode to cathode (unlike a switch). We can therefore take advantage of this fact.
I/O pins | 2 | 3 | 4 | 5 | 6 | 7 | 8 |
LEDs | 2 | 6 | 12 | 20 | 30 | 42 | 56 |
The table above shows the number of possible LEDs with respect to the number of I/O pins required. Fifty-six LEDs can be driven using only 8 pins. The only drawback is that only one LED can be driven at a time. Typical applications include; games, bargraphs, audio, video, or driving a single seven-segment LED display.
References:
Complementary LED Drive - Jean-Claude Rebic, Microchip