Nov 26, 2010 #1 S 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); } }
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); } }