Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

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

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top