GPS L10 HELP

General discussion on Libstock website & codes posted on this website.
Post Reply
Author
Message
tom-pearce14
Posts: 4
Joined: 17 Jan 2013 17:54

GPS L10 HELP

#1 Post by tom-pearce14 » 14 Mar 2013 12:41

Hello

I have my GPS L10 unit working on my microE 7 development board. I am sending the data out via serial communication on the UART line on the PIC. I want to only send the $GPRMC detail line. At the moment in send a massive string of data.

Here is the serial data being sent out; The line I only want is $GPRMC

N,00157.6879,W,112217.008,149,37*78
@$GPGSV,3,2,12,04,48,205,28,23,30,065,37,08,24,173,24,05,21,293,*78
@$GPGSA,A,3,23,08,30,04,16,07,29,02,13,,,,1.248,08,24,173,24,05,21,293,*77$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,26,20,02,115,13*78
$GPGLL,5043.4803,N,00157.6854,W,112546.000,A,A*4F
$GPGSA,A,3,23,08,30,04,16,07,29,02,13,,,,1.24,0.91,0.84*04
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$GPGSV,3,1,12,10,76,298,08,24,173,24,05,21,293,*77
$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,26,20,02,115,13*78
$GPGLL,5043.4803,N,00157.6854,W,112546.000,A,A*4F
$GPGSA,A,3,23,08,30,04,16,07,29,02,13,,,,1.24,0.91,0.84*04
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$GPGSV,3,1,12,10,76,298,08,24,173,24,05,21,293,*77
$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,26,20,02,115,13*78
$GPGLL,5043.4803,N,00157.6854,W,112546.000,A,A*4F
$GPGSA,A,3,23,08,30,04,16,07,29,02,13,,,,1.24,0.91,0.84*04
ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ$GPGSV,3,1,12,10,76,291,293,*77
$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,26,20,02,116,14*7C
$GPGLL,5043.4803,N,00157.6854,W,112547.000,A,A*4E
$GPRMC,112548.000,A,5043.4803,N,00157.6855,W,0.24,291.74,140313,,,A*7C
$GPVTG,291.74,T,,M,0.24,N,0.45,K,A*33
$GPGGA,1125481,293,*77
$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,26,20,02,116,14*7C
$GPGLL,5043.4803,N,00157.6854,W,112547.000,A,A*4E
$GPRMC,112548.000,A,5043.4803,N,00157.6855,W,0.24,291.74,140313,,,A*7C
$GPVTG,291.74,T,,M,0.24,N,0.45,K,A*33
$GPGGA,1125481,293,*77
$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,26,20,02,116,14*7C
$GPGLL,5043.4803,N,00157.6854,W,112547.000,A,A*4E
$GPRMC,112548.000,A,5043.4803,N,00157.6855,W,0.24,291.74,140313,,,A*7C
$GPVTG,291.74,T,,M,0.24,N,0.45,K,A*33
$GPGGA,1125481,293,*77
$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,26,20,02,116,14*7C
$GPGLL,5043.4803,N,00157.6854,W,112547.000,A,A*4E
$GPRMC,112548.000,A,5043.4803,N,00157.6855,W,0.24,291.74,140313,,,A*7C
$GPVTG,291.74,T,,M,0.24,N,0.45,K,A*33
$GPGGA,11254823,08,30,04,16,07,29,02,13,10,,,1.19,0.89,0.79*00
$GPGSV,3,1,12,10,76,292,18,13,56,061,29,02,50,276,14,07,48,149,37*77
$GPGSV,3,2,12,04,48,205,26,23,30,065,38,08,24,173,25,05,21,293,*78
GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,25,20,02,116,11*723,08,30,04,16,07,29,02,13,10,,,1.19,0.89,0.79*00
$GPGSV,3,1,12,10,76,292,18,13,56,061,29,02,50,276,14,07,48,149,37*77$GPGSV,3,2,12,04,48,205,26,23,30,065,38,08,24,173,25,05,21,293,*78
$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,25,20,02,116,11*723,08,30,04,16,07,29,02,13,10,,,1.19,0.89,0.79*00
$GPGSV,3,1,12,10,76,292,18,13,56,061,29,02,50,276,14,07,48,149,37*77
$GPGSV,3,2,12,04,48,205,26,23,30,065,38,08,24,173,25,05,21,293,*78
$GPGSV,3,3,12,16,12,053,32,30,08,027,35,29,07,336,25,20,02,116,11*7V,3,3,12,16,12,053,32,30,08,027,35,29,07,336,26,20,02,116,14*

Here is my code;

/*
* Project name:
GPS Click board
Test configuration:
MCU: PIC18F45K22
Oscillator: 8.0000 MHz Crysta

*/
// Uncomment to select desired GPS module
#define QUECTEL

// Variables used
char txt[768]; //768
char *string;
int i, latitude, longitude, GPRMC, GPGLL;
unsigned short ready;
int count;


//)******************************************************************************


void interrupt() {
if (RCIF_bit == 1) { // If interrupt is generated by RCIF
txt = UART1_Read(); // Read data and store it to txrt string
i++; // Increment string index
if (i == 768) { // If index = 768,
i = 0; // set it to zero
ready = 1; // Ready for parsing GPS data
}
RCIF_bit = 0; // Set RCIF to 0
}
}

void Display_Cursor(signed int lat, signed int lon) {
unsigned int latitude_y, longitude_x;

}

void main() {
IntToStr(longitude, txt);
ANSELC = 0; // Configure ports as digital I/O
ANSELD = 0;

ready = 0; // Initialize variables
i = 0;

UART1_Init(9600); // Initialize UART module at 9600

RC1IE_bit = 1; // Enable USART Receiver interrupt
GIE_bit = 1; // Enable Global interrupt
PEIE_bit = 1; // Enable Peripheral interrupt


count=0;
while(count<10) {
OERR1_bit = 0; // Set OERR to 0
FERR1_bit = 0; // Set FERR to 0

if(ready == 1) {
UART_Write_Text(Latitude); //Latitude
count = count+1;}

ready = 0; // If the data in txt array is ready do:
string = strstr(txt,"$GPRMC"); //
if(string != 0) { // If txt array contains "$GPRMC" string we proceed...
if(string[7] != ',') { // If "$GPRMC" NMEA message have ',' sign in the 8-th
// position it means that tha GPS receiver does not have FIXed position!



// If uBlox GPS receiver module is used :
#ifdef QUECTEL
latitude = (string[7]-48)*10 + (string[8]-48);
longitude = (string[19]-48)*100 + (string[20]-48)*10 + (string[21]-48);
if(string[17] == 'S') { // if the latitude is in the South direction it has minus sign
latitude = 0 - latitude;
}

if(string[31] == 'W') { // if the longitude is in the West direction it has minus sign
longitude = 0 - longitude;
}


#endif





}
}

}
}

Any help would be welcome.

Thanks

Thomas
UK

User avatar
filip
mikroElektronika team
Posts: 11874
Joined: 25 Jan 2008 09:56

Re: GPS L10 HELP

#2 Post by filip » 15 Mar 2013 10:00

Hi,

If you carefully read the example cod, you will see how you can extract any detail from any line :

Code: Select all

string = strstr(txt,"$GPGLL");
      if(string != 0) {            // If txt array contains "$GPGLL" string we proceed...
        if(string[7] != ',') {     // If "$GPGLL" NMEA message have ',' sign in the 8-th
                                   // position it means that tha GPS receiver does not have FIXed position!
            latitude = (string[7]-48)*10 + (string[8]-48);
            longitude = (string[19]-48)*100 + (string[20]-48)*10 + (string[21]-48);
            if(string[17] == 'S') {           // if the latitude is in the South direction it has minus sign
              latitude = 0 - latitude;
            }
            if(string[31] == 'W') {           // if the longitude is in the West direction it has minus sign
              longitude = 0 - longitude;
            }
From the incoming stream of data from the GPS module, the code will filter out the line that starts with the $GPGLL,
and it will parse the data after the $GPGLL keyword.

Regards,
Filip.

Post Reply

Return to “Libstock Discussion”