0
3.0kviews
Write C language program to toggle bit P1.5 of part 1 continuously after 50 ms delay. Generate delay using for loops.
1 Answer
written 6.0 years ago by | • modified 5.9 years ago |
The program
#include <reg51.h>
sbit led=P1^5; //make P1.5
as LED
void delay( unsigned int);
void main ()
{
led=1;
delay(50);
led=0;
while(1);
}
void delay (unsigned intitime)
{
unsigned int x,y;
for(x=0; x<itime; x++)
for (y=0; y<1275; y++);
}