I have hooked up a gps to the com2 channel, and set the gps module to output only the two sentence types I need, at 5hz.
Now the question is, how can I read that data and convert into useful variables in the most efficient way?
How can I get those two sentences in one string variable in order to split up and decode? At the moment with the following code I am getting mostly stable output (i.e cleans lines of data) but every few seconds it gets out of sync and i get partial and joined sentances.
Code: Select all
Do
GPS_in = GetQueueStr(com2RXQueue)
Debug.print GPS_in
call sleep(0.2)
Loop
Code: Select all
$GPGGA,212048.059,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*42
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212048.260,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4A
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212048.460,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4C
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212048.659,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*44
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212048.859,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4A
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212049.059,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*43
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212049.260,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4B
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212049.460,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4D
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212049.659,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*45
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212049.859,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4B
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212050.059,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4B
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212050.260,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*43
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212050.46
0,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*45
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212050.659,8960.0000,N,00000.0000,E
,0,0,,137.0,M,13.0,M,,*4D
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212050.859,8960.0000,N,00000.0000,E,0,0,,137.0
,M,13.0,M,,*43
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212051.059,8960.0000,N,00000.0000,E,0,0,,1
37.0,M,13.0,M,,*4A
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212051.260,8960.0000,N,00000.0000,E,0,0,,137.0,M,13
.0,M,,*42
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212051.460,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*44
$GPV
TG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212051.659,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*4C
$GPVTG,0.00,T,,
M,0.00,N,0.00,K,N*32
$GPGGA,212051.859,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*42
$GPVTG,0.00,T,,M,0.00,N,0.0
0,K,N*32
$GPGGA,212052.059,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*49
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
$GPGGA,212052.260,8960.0000,N,00000.0000,E,0,0,,137.0,M,13.0,M,,*41
$GPVTG,0.00,T,,M,0.00,N,0.00,K,N*32
Cheers
Ben[/code]