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

Problem with arrays
Goto page Previous  1, 2
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
ezflyr



Joined: 25 Oct 2010
Posts: 1019
Location: Tewksbury, MA

View user's profile Send private message

PostPosted: Thu Jun 27, 2013 8:44 am     Reply with quote

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

View user's profile Send private message

PostPosted: Thu Jun 27, 2013 1:10 pm     Reply with quote

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

 
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