serial communication in 8051

Status
Not open for further replies.

svinoth86

Newbie level 6
Joined
Nov 13, 2010
Messages
12
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,420
how to interface serial communication in 8051?

---------- Post added at 12:23 ---------- Previous post was at 12:21 ----------

//serial commn
#include <REGX51.H>
unsigned char serial_receive()
{
unsigned char r;
while(RI==0);
r=SBUF;
RI=0;
return r;
}
serial_transmit(unsigned char t)
{
SBUF=t;
while(TI==0);
TI=0;
}
void main()
{
TMOD=0X20;//t1,mode2
SCON=0X50;
TH1=0XFa;//9600 br
TR1=1;
while(1)
{
unsigned char t;
t=serial_receive();
serial_transmit(t);
}
}
 

it ll work start to downloading
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…