GPS with a LS20031

Problem:

The GPS library, Gives me "Overflowed message limit" when I do gps.sample, so as any good hacker would do; I will start from scratch (also I want more information from my gps than lat/long).

Goals:

  • Latitude/Logitude
  • Time
  • Altitude
  • Speed
  • Course/Bearing

Progress:

Setup on for the GPS:

$PMTK314,0,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0*29 -- Turn off all messages but RMC GGA VTG
$PMTK251,19200*22   -- Sets the baud rate to 19200

 

Borrowing some code from the GPS library: (http://mbed.org/projects/cookbook/svn/GPS/trunk/GPS.cpp)

char msg [256];

void getline() {
    while (gps.getc() != '$');
    for (int i=0; i<256; i++) {
        msg[i] = gps.getc();
        if (msg[i] == '\r') {
            msg[i] = 0;
            return;
        }
    }
}
void sample() {
    getline();
    if (strncmp ("GPGGA",msg,5) == 0) {
        parseGGA(msg);
    } else if (strncmp ("GPRMC",msg,5) == 0) {
        parseRMC(msg);
    } else if (strncmp ("GPVTG",msg,5) == 0) {
        parseVTG(msg);
    }
}


0 comments

You need to log in to post a comment