Write a program for serial reception.


#include<8051.h>
void reception();
void rec_init();
void lcd_init();
void lcd_cmd(unsigned char b);
void display(unsigned char b);
void delay(unsigned int i)
{
while(i!=0);
{
i–;
}
}
void rec_init()
{
TMOD=0x20;
SCON=0x50;
TH1=0xfd;
TR1=1;
}
void reception()
{
        unsigned char a;
a=SBUF;
delay(500);
RI=0;
}

void lcd_init()
{
lcd_cmd(0x38);
lcd_cmd(0x01);
lcd_cmd(0x0c);
}
void lcd_cmd(unsigned char b)
{
P1=b;
delay(300);
P3_3=0;
P3_4=1;
P3_4=0;

}
void display(unsigned char b)
{
P1=b;
delay(300);
P3_3=1;
P3_4=1;
P3_4=0;
}
void main()
{
lcd_init();
P1=0x00;
rec_init();
if(RI==1)
{
reception()
delay(0xffff);
}
}

Add Comment