This will not work.... I found this out myself a while ago.... I will still drop characters.
Use this..
C:while(!TXSTAbits.TRMT );// Wait until empty TXREG = RCREG;
I did it as you suggested:
Code:
while(1)
{
if(PIR1bits.RCIF == 1) // if the USART receive interrupt flag has been set TO ZERO
{
while(!TXSTAbits.TRMT );// Wait until TXREG is empty
{
TXREG = RCREG; // echo received data back to sender
}
}
}
.. but it is still not working.