0
1.2kviews
Draw interfacing diagram of LED to port pin P2.4 of 89C51 write C language program to turn ON and OFF LED after 20 ms delay.
1 Answer
written 5.9 years ago by | • modified 5.9 years ago |
program
#include<reg51.h>
sbit led=P2^4; //make P2.4 as LED
void delay (void);
void main ()
{
led=1;
delay( );
led=0;
while(1);
}
void delay (void)
{
TMOD= 0x10;
TH1=0xDC;
TL1=0x00;
TR1=1
while(TF1==0);
TR1=0;
TF1=0;
}