CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Clearing Serial Rx Data

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ronald
Guest







Clearing Serial Rx Data
PostPosted: Wed Mar 02, 2005 2:47 am     Reply with quote

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
PostPosted: Wed Mar 02, 2005 4:53 am     Reply with quote

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
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
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