Strange GPS fractional minutes
JacE
Posts: 6
hello everybody,
This time i've got a problem with my gps-module.
I need the lat and long coordinates for my navigation. My get-method looks like this:
Thoses methods exist for every part of the coordinates (degrees,minutes, fractional minutes)
The methods for degrees and minutes are working fine, but both fracmin-methods are returning with negative results:
Could somebody see where my mistake is?
This time i've got a problem with my gps-module.
I need the lat and long coordinates for my navigation. My get-method looks like this:
public int getLongFracmin() { smartRequest(GetLong,5); lngFracmin = (buf&0xFF)|(buf<<8); return lngFracmin; }
Thoses methods exist for every part of the coordinates (degrees,minutes, fractional minutes)
The methods for degrees and minutes are working fine, but both fracmin-methods are returning with negative results:
Javelin Terminal said...
Your current position is:
Longitude: 9 1 -5883
Latitude: 51 37 -5883
Could somebody see where my mistake is?
Comments
Your routine uses
lngFracmin·=·(buf&0xFF)|(buf<<8);
I assume this is a typo because it will not compile.
If you use simply System.out.print(lngFracmin) then
the number appears negative if it is in the range 0x8000-0xFFFF
I believe the lngFracmin value should be in range 0-9999
Is it possible your actual expression looks like
··· lngFracmin = (buf[noparse][[/noparse]2]&0xFF)|(buf[noparse][[/noparse]3]<<8);
(swapped buf locations)
regards peter
Thank you for your patience (and sorry for my english )
Regards
Edit:
I've attached my Gps_Parallax.java as .txt
Post Edited (JacE) : 11/30/2009 2:01:50 AM GMT
Attached is the correct version.
BTW, your 'shorter' methods require multiple calls to smartRequest.
The class holds public variables for LAT and LNG, all of which
are valid after a single call to smartRequest.
You can use these variables directly, no need to create wrapper methods.
regards peter
Post Edited (Peter Verkaik) : 11/30/2009 2:31:31 AM GMT