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

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