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 pic16f877a

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 communicationn with pic16f877a?

---------- Post added at 13:51 ---------- Previous post was at 13:51 ----------

#include<htc.h>
unsigned char sr_rx()
{
unsigned char r;
while(!RCIF);
r=RCREG;
RCIF=0;
return r;

}
sr_tx(unsigned char t)
{
TXREG=t;
while(!TXIF);
TXIF=0;
}

void main()
{
unsigned char a;
//TRISC=0xff;
//PORTC=0xff;

TXSTA=0x24;
RCSTA=0x90;
SPBRG=0x19;

while(1)
{
// sr_tx('b');
a=sr_rx();
sr_tx(a);
}
}
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top