Show Posts
Pages: [1]
1  Forum 2005-2010 (read only) / Interfacing / Re: GPS Logging not producing right format. on: January 19, 2011, 03:01:07 pm
I see what you mean! Thank you, I have been pouring over this for a while and missed that detail..
2  Forum 2005-2010 (read only) / Interfacing / GPS Logging not producing right format. on: January 19, 2011, 02:40:48 pm
Hello,

I recently began a small project to both display the latitude and longitude on a LCD screen and log the GPS data.

The problem I am encountering is when I record the data to the SD card the data is not formatted correctly. Tools like GPS visualizer require that each GPS data sentence be on its own line.

My code is based on ladada gps shield GPS test parsing sketch.

Here is my code snippets.
Quote
void loop()

  uint32_t tmp;
int intpart;
  
  Serial.print("\n\rread: ");
readline();

//buffer =  mySerial.read();
  // check if $GPRMC (global positioning fixed data)
  //check to see if we have any message... then process.
  
 
 

   
  //This section is used for parsing and interpretation.
  
  if (strncmp(buffer, "$GPRMC",6) == 0) {
     

Quote
if(card.write_file(f, (uint8_t *) buffer,buffidx) != buffidx) {
         putstring_nl("can't write!");
  }
  
    
}

Quote
void readline(void) {
  char c;
  
  buffidx = 0; // start at begninning
  while (1) {
      c=mySerial.read();
      if (c == -1)
        continue;
      Serial.print(c);
      //if (c == '\n')
       // continue;
    //  buffer[buffidx+1] = 0 ;
      if ((buffidx == BUFFSIZ-1) || (c == '\r') || (c == '\n')) {
        buffer[buffidx]='\r';
        buffer[buffidx+1] = '\n';
        buffer[buffidx+2] = 0;
        return;
      }
      buffer[buffidx++]= c;
  }
}


What I am currently getting as output:
Quote
$GPRMC,02454240.7638,N,08312.6058,W,0.29,305.19,190111,,*14$GPRMC,024327.000,A,4240.7641,N,08312.6109,W,0.21,267.70,190111,,*1F$GPRMC,024328.000,A,4240.7628,N,08312.6135,W,0.26,254.60,190111,,*16$GPRMC,024329.000,A,4240.7618,N,08312.6154,W,0.27,249.66,190111,,*18$GPRMC,024330.000,A,4240.7620,N,08312.6153,W,0.10,285.42,190111,,*1E$GPRMC,024332.000,A,4240.7632,N,08312.6146,W,

What I should be getting:
Quote
$GPRMC,041918.000,A,4240.7654,N,08312.5918,W,0.65,104.70,180111,,*12
$GPRMC,041919.000,A,4240.7669,N,08312.5982,W,0.38,134.59,180111,,*1E
$GPRMC,041920.000,A,4240.7673,N,08312.6029,W,0.44,139.75,180111,,*1C
Any suggestions would be very helpful!
Pages: [1]