|
|
View previous topic :: View next topic |
Author |
Message |
ronald Guest
|
Clearing Serial Rx Data |
Posted: Wed Mar 02, 2005 2:47 am |
|
|
Hi,
i'm using getting GPS signals to my PIC 18F452 and am using a PIC C compiler.
the problem i'm experiencing is that if i execute a code that is too lengthy between the sequential retreiving of the GPS data (once every second), then my system hangs and cannot get the next set of data.
i understand from a friend the way about this is probably to clear the serial Rx buffer just before i read from it. Will anyone be able to advice me if this is correct and what code/function should i use to implement this.
Thanks a lot |
|
|
Ttelmah Guest
|
Re: Clearing Serial Rx Data |
Posted: Wed Mar 02, 2005 4:53 am |
|
|
ronald wrote: | Hi,
i'm using getting GPS signals to my PIC 18F452 and am using a PIC C compiler.
the problem i'm experiencing is that if i execute a code that is too lengthy between the sequential retreiving of the GPS data (once every second), then my system hangs and cannot get the next set of data.
i understand from a friend the way about this is probably to clear the serial Rx buffer just before i read from it. Will anyone be able to advice me if this is correct and what code/function should i use to implement this.
Thanks a lot |
Add the 'ERRORS' command to the #use RS232 setup.
The problem is that if the internal hardware buffer is not read in time, the UART, sets it's 'overflow' flag, and will stop receiving characters till this is cleared. Just reading the buffer, will not clear this. The 'ERRORS' command, tells the compiler to automatically clear this flag, and if you then read the buffer, things will carry on working. :-)
Best Wishes |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|