Interfacing of LED with 8051 Microcontroller

LED INTERFACING
4.1 Introduction
When you need to add light to a model, an ordinary filament lamp is the first thing that springs to mind. But if you don’t need a high light output, or you need light as an indicator, an LED has many advantages over a lamp. LEDS are basically the single light display that include incandescent and are treated as single binary points to be switched on and off by programmer instructions. The individual light display is easy to use. A port presents a bit or a character and then strobe the device.



4.2 ADVANTAGES OF LEDs
4.2.1 Shapes and Sizes:
LEDs are available in many shapes and sizes, some of which are shown in the selection below. The 'standard' LED shape is the 5mm diameter domed type, and the smaller 3mm domed type is also popular.
1. Tri-LED array
2. 10 segment bar displays
3. Domed LED sizes 3, 5, 8, 10mm
4. Panel mounting LED
5. PCB mounting LED
 6. 26mm red & green LED cluster
4.2.2 Colors:
LEDs have traditionally been red, orange, yellow, or green, but advances in LED technology mean that blue and white LEDs are now available, though at a much higher price. These LEDs are considerably brighter than standard LEDs so they could be used for lighting, but you will find the ones described as 'white' still have a blue tinge. Also available are LEDs described as 'bi-color' and 'tri-color'. Bi-color LEDs typically incorporate one red and one green LED in the same package. Since they have only two leads, only one LED can be on at any time. Tri-color LEDs also have two LEDs in one package, but because they have three leads, both LEDs can be switched on together, their light combining to make a third color, typically orange. The central lead of such a package is the common for both LEDs. Some manufacturers produce true 'tri-color' LEDs incorporating red, green, and blue LEDs, so in theory it is possible to create light of any color. The physical color of an LED package does not necessarily indicate the color it will be when switched on. Some LEDs have a clear plastic package, while others may have a diffused plastic package.
1. Standard red, green and yellow LEDs
 2. Bi-color LEDs
3. Tri-color LEDs
4.2.3 Current Consumption:
LEDs consume much less current than lamps - usually only 20mA - so they are ideal for battery powered models.
4.2.4 Long Life:
LEDs rarely fail (unless you supply them with the wrong voltage!) so are handy in parts of a model that are hard to reach.
Which Way Around?
How can you tell which lead on an LED is which? Figure 2 shows a standard domed LED. If brought new, you will find that the longest lead is the positive lead, or 'anode', and the shortest lead is the negative lead, or 'cathode'. If the leads have been cut there are a few other ways to find out the polarity:
• The plastic package nearest the cathode will be flattened slightly.
• When holding the LED up to a light, the largest triangular section inside will be nearest the cathode. You can also connect up the LED (as in Figure 1) both ways around to see which is correct - reverse biasing the LED won't do it any harm.
4.3 HARDWARE CONNECTIONS:
For interfacing a single Led to 89c51 microcontroller, we connect the anode (+) end of LED to the designated port pin via a pull-up resistor. While the cathode end of LED is connected to GND. Connection of 1 LED to 89c51 port pins is as shown in figure. For glowing a LED, a high logic is required at the anode (+), so port pin is set to high for glowing LED. One end of single LED is connected to port pin of 89c51 via a pull up resistor and other one is grounded. In Switch, One end is connected to port pin of 89c51, while other one is grounded.



LED Interfacing


4.4 Program to blink LED’s clockwise:
      #include<reg51.h> /* include the file reg51.h
       void delay(); /*declaration of a function delay()
       void main()
      {
      P0=0x80;  /*assigning a value to port 0
delay();
P0=0x40; /*assigning a next  value to port 0
delay();
P0=0x20;
delay();
P0=0x10;
delay();
P0=0x08;
delay();
P0=0x04;
delay();
P0=0x02;
delay();
P0=0x01;
delay();
}
void delay()
{
int i;
for(i=0;i<=30000;i++)
{
}
}

Comments

Popular posts from this blog

AUDIO SPOTLIGHTING

Electronic Reconnaissance, ELECTRONIC COUNTERMEASURES (ECM), ELECTRONIC COUNTER-COUNTERMEASURES (ECCM)

INTERFACING OF EEPROM with 8051