9.7 PROJECT 9.7 – Connecting more than one LED to a Port Pin
9.7.1 Project Description
There are some applications where we may want to connect many LEDs to a microcontroller, but where only one LED is required to be ON at any time. One such application is the design of a Roulette board, which requires 37 LEDs, and only one LED is ON at any time. In principle, we can use a high-end microcontroller with many I/O pins for such applications. But, as we shall see in this project, for low-cost applications it is preferable to use a cheaper low-end microcontroller and share the I/O pins. This approach requires less wiring and less number of current limiting resistors, resulting in a much lower cost.
As shown in Figure 9.37, connecting two LEDs to an I/O port is very easy. One LED is connected in current sourcing mode, while the other LED is connected in current sinking mode. When the port pin is at logic LOW, LEDA is turned ON, when it is at logic HIGH, LEDB is turned ON.
It is possible to connect more than two LEDs to a port pin, where only one LED is ON at any time. Here, we connect two LEDs between each pair of I/O pins, where the LEDs are connected in opposite directions. Thus, with 3 I/O pins, we can have up to 6 LEDs, with 4 I/O pins we can have up to 12 LEDs, and so on. The maximum number of LEDs that can be connected can be calculated ...
Get Using LEDs, LCDs and GLCDs in Microcontroller Projects now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.