Today we are going to learn how interface an led with 89c51, In this program we are interfacing an LED with 0th pin of port-1, In the program port-1 is expressed as P1 and 0th pin of port-1 can be express us P1^0
89c51 LED Blink CODE
#include<reg51.h>
sbit led=P1^0;
void delay(int n)
{
int i,j;
for(i=0;i<n;i++)
{
for(j=0;j<100;j++);
}
}
void main()
{
led=1;
delay(100);
led=0;
delay(100);
}
Follow these Steps
Circuit Diagram
Download code and design here
No comments:
Post a Comment