I'm working on a project where I'm reading data from a gps.
Here's my problem, the GPS Knots string changes in length
When stationary it reads e.g. ,0.0,
When the slightest movement e.g. ,2.28,
With more movent ,38.71,
More ,78.97,
Breaking the speed limit ,100.73,
I tried using DEC to grab the numbers but this didn't work reliably
So I used STR and looked for the , before and , after the string which works well. But when trying to convert the string from Knots to MPH (x 1.15) here I hit my problem.
As the string varies in length the Knots 100x 10x 1x etc move around in the Knots[6]
eg.
0.0????
0.11???
11.11?
111.11
And lastly once converted i need to be able to read the MPH out one chr at a time to write to screen. And i'm only looking the whole MPH nothing after to .
Any pointers are welcome.
Rob
A few example strings below
$GPRMC,201639.219,A,5124.2293,N,00029.3233,E,0.0,0 00.0,020304,,*01
$GPRMC,201651.219,A,5124.2280,N,00029.3227,E,2.28, 291.1,020304,,*3B
$GPRMC,201854.211,A,5124.5346,N,00029.7814,E,38.71 ,079.8,020304,,*02
$GPRMC,201948.207,A,5124.6416,N,00029.1546,E,78.97 ,279.9,020304,,*0B
$GPRMC,202200.199,A,5124.6983,N,00030.1561,E,100.7 3,080.1,020304,,*3F
KNOTS[6]
SERIN2 PORTb.1,188,1000,NoData,[WAIT("$GPRMC,"),dec2 HH,DEC2 MM, dec2 ss,_
skip 5,Lock,_ 'Looks for V or A
wait(","),dec2 latA,Dec2 LatB,_ 'Looks for Lat 2 digits
wait("."),DEC2 LatmsA,DEC2 LatmsB,_
wait(","),NS,_
wait(","),LonA,Dec2 LonB,dec2 Lonc,_
wait("."),DEC2 LonMSA,DEC2 LonMSB,_
wait(","),EW,_
wait(","), str Knots\6\",",str head\5\",",dec2 d,dec2 m,dec2 y]
Bookmarks