LED interfacing with 8051



CART
We if ordered by 4PM (excluding holidays), then courier usually takes 2-5 days. Available
Quantity :    Price : Rs. 0
Download Files
Our Return policy
    We will accept returns within 3 days from the date of delivery of the item.

LED Interfacing with 8051

LED is a semiconductor device used in many electronic devices, mostly used for signal transmission /power indication purposes. It is very cheaply and easily available in a variety of shape, color, and size. The LEDs are also used for design message display boards and traffic control signal lights etc.

It has two terminals positive and negative as shown in the figure.

LED PolarityLED Polarity

The only way to know polarity is either to test it with a multimeter or by carefully observing inside the LED. The larger end inside the led is -ve (cathode) and the shorter one is +ve (anode), that is how we find out the polarity of the LED. Another way to recognize the polarity is, connecting leads, POSITIVE terminal has more length than NEGATIVE terminal.

LED Interfacing to 8051

There are two ways which we can interface LED to the Microcontroller 8051. But the connections and programming techniques will be different. This article provides the information on LED interfacing with 8051 and LED blinking code for AT89C52/ AT89C51 Microcontroller.

Interfacing LED to 8051 MethodsInterfacing LED to 8051 Methods

Observe carefully the interface LED 2 is in forward biased because the input voltage of 5v connected to the positive terminal of the LED, So here the Microcontroller pin should be at LOW level. And vice versa with the interface 1 connections.

The resistor is important in LED interfacing to limit the flowing current and avoid damaging the LED and/or MCU.

  • Interface 1 will glow LED, only if the PIN value of the MC is HIGH as current flows towards the ground.
  • Interface 2 will glow LED, only if the PIN value of the MC is LOW as current flows towards PIN due to its lower potential.

-INterfacing ckt.JPG

 

Code

#include<reg51.h>


sbit LED=P2^0;


void delay(unsigned int time)

{

int i,j;

for(i=0;i<time;i++)

for(j=0;j<1275;j++);

}


void main()

{

while(1)

{

LED=1;

delay(100);

LED=0;

delay(100);

}

}

 



2017 All Rights Reserved | by: eucprojects.com