Sunday, March 6, 2011

8051 Simple Programs


Led Blink At 1sec

#include<reg51.h>
sbit led1=P1^2;

void delay(int time)        //This function produces a delay in msec.
{
    int i,j;
    for(i=0;i<time;i++)
     for(j=0;j<1275;j++);
}

void main()
{
     while(1)
    
 {
          led1=0;
          delay(20);
          led1=1;
          delay(20);
  }

}  

Components Required:
1.AT89C51 40 pin microcontoller
2.Led
3.10uf -(1) no's, 0.33 -(2)no's capacitors
4.330ohm Resistor
5.11.0592 crystal oscillator
6.5v power supply
7.Bread board
8.Connecting wires