You are using one of the newer GPS's with a little higher resolution. With any handheld gps, there will be a little wandering of the output. You will see slight position changes, even though you are standing still. This will result in a display of speed, although it will be very low speed.
The checksum is used to ensure the device reading the gps doesn't receive faulty input. If it is important for your application, the Pic chip can be made to perform a checksum on the sentence, and compare it to the one the gps calculated. If it differs, the data read from the gps is corrupt, and must be read again.
To convert Knotts to km/h, multiply by 1.852. Since PICs don't do decimal, we will have to make our own. A close enough approximation of knotts x 1.852 is (knotts x 2048)/11, but remind yourselft that your result will have two digits past the decimal point. If you want whole numbers for km/h then divide by 100, or do (knotts x 2048)/1100. A handy tool to figure these fractions out is a download at the very bottom of this page: http://www.miscel.dk/MiscEl/miscel.html
To convert, you follow my earlier example, but insert skips to match the format of your NMEA sentence.
For your:
Code:
$GPRMC,123339.000,A,5134.2770,N,00007.8480,E,1.14, 254.38,271009,,*09
it would be something like:
Code:
SerIn2 GPSin,baudGPS,Timeout,Nogps,[wait("$GPRMC"),skip 14,DEC2 lat_deg,DEC2 lat_min,skip 1,DEC3 lat_min_dec ....]
you should be able to enter the rest for longitude now....
The degrees and whole minutes are already in the format you want. We just need to convert decimal minutes into seconds. To do this, we use the same conversion I showed you in the previous example (except you will see that I forgot to add another digit for the seconds result). Here you have .2770 minutes. We only care about the first three digits. In fact, we might care about even fewer digits, but since we used three of the digits in the last example, lets just use three again.
The following will multiply your 277 by 6. This will give you a result of 1662, which really is 16.62, but again, the PIC can't do decimal, so we will use the whole number, and just format it for output.
Code:
lat_seconds = lat_min_dec * 6
DEBUG DEC lat_deg," deg ",DEC lat_min," min ",DEC lat_seconds dig 3,DEC lat_seconds dig 2,".",DEC lat_seconds dig 1, DEC lat_seconds dig 0," sec",13,10
That would print out:
"51 deg 34 min 16.62 sec", which matches pretty well with the 51 34 16 that you converted on line.
Bookmarks