 |
 |
| View previous topic :: View next topic |
| Author |
Message |
ezflyr
Joined: 25 Oct 2010 Posts: 1019 Location: Tewksbury, MA
|
|
Posted: Thu Jun 27, 2013 8:44 am |
|
|
Hi,
As I mentioned a month ago, and has been reiterated recently, you really need to implement an interrupt driven circular buffer with a GPS project.
The GPS constantly transmits NMEA data to the PIC, so turning interrupts On/Off will cause you to lose data. Data buffering is definitely the way to
go with a project like this! Yes, you can massage your current code to kind of work, but it won't be robust/reliable!
Regarding your question about validating the transmitted checksum, here is a routine that takes buffered data and calculates the checksum.
| Code: |
char calculate_checksum(void)
{
// This subroutine calculates the NMEA checksum by XORing all the NMEA sentence characters together exclusive of the '$'
// and '*' characters.
int8 i;
char value = 0;
value = 0;
for(i = 0; Msg_Buffer[i] != '*'; i++)
{
if (Msg_Buffer[i] != '$')
value ^= Msg_Buffer[i];
}
return(value);
}
|
You'll need to parse the NMEA string to extract the checksum characters, and then convert them into a numerical value before comparing to the
value returned by the above routine.
John |
|
 |
filjoa
Joined: 04 May 2008 Posts: 260
|
|
Posted: Thu Jun 27, 2013 1:10 pm |
|
|
Hi
thanks for your comments
I know my code is not structured in the best way, the fact that I do not program for a long time, do this, but this is just a draft.
I hope with these comments make some more robust, for a future project.
thanks for your help
best regards |
|
 |
|
|
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
|