Page 1 of 1

gps

Posted: Thu Oct 29, 2009 5:03 am
by naz
how to take NMEA message from gps to lpc2148.

Posted: Thu Oct 29, 2009 6:18 am
by leon_heller
Usually, you connect it to a UART.

Posted: Thu Oct 29, 2009 9:01 pm
by naz
yes it's correct,i'm asking about software side.currently we did only uart initialization.apart from that we have take data from gps to lpc2148 memory.give some idea

Posted: Tue Nov 17, 2009 5:51 pm
by MaxQ
The simplest thing is to poll U0LSR (or U1LSR, depending which UART you are using) to see if there are any characters waiting, then pull them into a buffer, e.g.:

char buf[256];
int count = 0;

while ((U0LSR & 1) && (count < 256))
{
buf[count] = U0RBR;
count += 1;
}

Then scan through the buffer until you find a '$' character. Throw away everything before this character. Then scan until you find a '*' followed by two more characters and <CR><LF>. This delimits a complete sentence. If you don't have a complete sentence in the buffer, go back and wait for more characters to arrive. If you do have a complete sentence, compute and verify the checksum. If the checksum is correct, process the sentence. If the checksum is incorrect, throw the sentence away and look for the next sentence in the buffer.

Because you have a reliable communications channel (direct connection between the GPS module and the LPC2148 UART), it is probably unnecessary to check the checksum.