Hi. I'm just trying to log gps nmea data. I don't know what's wrong in my code.
My controller hangs at a particular point** and restarts itself. Can any body tell what's wrong in it ?
I'm using 16F913 with inbuilt usart module and GPS module transmitting only GPRMC data. _________________ manibabu
Douglas Kennedy
Joined: 07 Sep 2003 Posts: 755 Location: Florida
Posted: Thu Nov 27, 2008 8:41 am
A typical gps squarks ( sends a sentence when it wants) it is rare that they are polled ( asked to send first). This means the PIC has to be ready at any and all times to catch the incoming chars. This can be done without a hardware USART isr service routine but by not using an isr the task becomes very very timing critical and worse is when it doesn't work it is hard to guess at what exactly in the timing caused it to fail. I'd recommend strongly using an isr that feeds a circular buffer that will hold the sentence. The isr could score the input....$ received sets the score to zero a "G" moves it to 1 providing it was at zero a "P" moves only a one to two and so on till your sentence name is received then you can have the isr gate the rest of the sentence char by char into the circular buffer. When the sentence is fully received set a flag in the isr to let your main code know it can begin to parse the sentence. The isr approach has the great advantage that it can allow your main routine to use the time in between the GPS squarks to process the last sentence received.
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