Naumanpak
Member level 2
Experts,
I am reading serial data from a GPS into PIC. And it works fine(data is being sent at 1hz).
PROBLEM:
Going further, I will put some instructions that will require a 5 ms delay once every second.
but if I put some delay, RCIF overflows never sets again, I get only 2 char printed.
By checking the overflow, I can revive continuous transmission but the data received is not correct.
Any help will be appreciated.
thanks
I am reading serial data from a GPS into PIC. And it works fine(data is being sent at 1hz).
PROBLEM:
Going further, I will put some instructions that will require a 5 ms delay once every second.
but if I put some delay, RCIF overflows never sets again, I get only 2 char printed.
By checking the overflow, I can revive continuous transmission but the data received is not correct.
Code:
if(RCSTA.OERR==1){
RCSTA.CREN= 0 ;
RCSTA.CREN=1;}
Any help will be appreciated.
thanks
Code:
void main()
{
unsigned char ch='\0';
TRISB = 0;
TRISD = 0;
Lcd_Ini();
SPBRG=0x26;
TXSTA.SYNC=0;
RCSTA.SPEN=1;
RCSTA.RX9=0;
RCSTA.CREN=1;
RCSTA.RX9=0;
while (1)
{
while(!PIR1.RCIF){;}
ch=RCREG;
RCREG=0;
//PIR1.RCIF=0;
LCD_putc(ch);
// Delay_ms(5);
}
}