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
0
6views

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;

}

enter image description here

Please log in to add an answer.