could you post source with the code tags? it indents properly and is much more readable.
This code will work for all Oscillators, without restriction b'coz there is no need to have an delay instead the code simply check whether the previous byte has been sent or not by checking the TXIF bit, if the TXIF bit is 1 then we can assume the previous byte has been sent and Transmit register TXREG is now ready to send next byte. IIIly if RCIF is 1 then we can assume there is a byte in RCREG.
#include<pic.h>
void main()
{
unsigned char ReceiveChar;
TRISC=0xc0; //Set RX and TX pin as input to enable serial communication
TXSTA=0x24; //Transmit Enable (TXEN=1) and Select high baud rate(BRGH=1) leave rest
SPBRG=25; //select baud rate 9600 by moving decimal 25 to SPBRG when BRGH=1
RCSTA=0x90; //Enable continuos receive and enable usart communication(SPEN=CREN=1)
TXREG='0'; //Sending a dummy character to initialize commn so at the end of last bit TXIF will be set to 1 or we can set TXIF to 1 to start sending bytes
while(1) //repeat the following forever
{
if (RCIF==1) //if character is received from PC
{
ReceiveChar=RCREG; //move the character to a variable
if (TXIF==1) //if TXREG is empty
TXREG=ReceiveChar; // send the same character to PC
}
}
}