LED(s) Interfacing with AT89C51

LED stands for Light Emitting Diode. LED is semiconductor device which has wide number of applications such as Indicators, Lightning System and Advertising Displays etc. To turn LED ON we need to apply forward voltage of ≥1.7V. Typically LEDs drag current from 1mA to 20mA. So one may design the resistor value to control the current passing through the LED using Ohm’s Law R=V/I. LEDs are not only used for ON/OFF applications but for controlling light intensity in home applications also using PWM (Pulse Width Modulation).

8051 Microcontroller has the capacity to sink/source the maximum current of 10mA on single I/O Port Pin. If we want to interface an LED to any port pin then we must think of in which way it would be better for interfacing so that LED will work properly for lifetime.

LEDs can be interfaced either in Common Cathode fashion (As shown in the above diagram) and Common Anode fashion.

Common Cathode fashion: The Cathode terminals of all the LEDs should be combined together and connected to Ground potential and the Anode terminals of all the LEDs should be connected to separate port pins. In this case, we need to send Logic ‘1’ on the corresponding port pin to turn the LED(s) ON and Logic ‘0’ to turn LED(s) OFF. This kind of interfacing is quite easy in programming point of view.

Common Anode fashion: The Anode terminals of all the LEDs should be combined together through current limiting resistors and connected to Positive terminal of the power supply and the Cathode terminals of all the LEDs should be connected to separate port pins. In this case, we need to send Logic ‘0’ on the corresponding port pin to turn the LED(s) ON and Logic ‘1’ to turn LED(s) OFF. This kind of interfacing is quite confusing in programming point of view.

Leave a Reply

*