GPS problem

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Dear all,

I am using VB .NET to write a GPS application. However, what I get from the
serial port is something like "$???????" instead of the standard data format
string. I guess it may due to the encoding problem since GPS data is ASCII
but the Default encoding for VB .NET is Unicode. Is there anyway to change
the default encoding?

Kempton
 
Dear Chris,

Can you give me example. I tried myself but I got nNullReferenceException.

here is my code:
Imports System.Text
Imports CFSerial Class

private sub TimerGPS_Tick(Byval sender as System.Object, ByBAl e as
System.EventArgs) Handlers TimerGPS.Tick
Try
dim enc as ASCIIEncoding
dim inbuf() as byte = enc.GetBytes(GPSPort.InputString)
Dim instr as string = encGetString(inbuf,0,inbuf.Length -1)
txtGPS.Text = instr
catch ex as Exception
msgbox(ex.message, Msgboxstyle.Critical)
End try
end sub
 
I solve the NullReferenceException problem by

dim enc as New ASCIIEncoding.

But I still got "??????" strings. What can I do? Can I change the default
encoding?

Kempton
 
Hello,

Are you sure that these "?" don't simply mean that your GPS system is not
synchronized with enough satellites ?
I also work with devices with embedded GPS and as long as the GPS module
isn't synchronized with at least 3 satellites, I receive blank strings or
null strings, it depends on the module.

Regards,

Thomas
 
What you have done seems to be correct and works for me. I'm not sure, but
I'd say if you are getting $?????????? then that's because that is what the
GPS unit is outputting. Do you know if the GPS unit actually has a lock?
If it's a new unit, some units take a long time to get the first lock (the
first one I got I had to leave outside for 20 minutes before anything
happened, although after that it rarely takes more than 1-2 minutes).

Steven
 
Hi,

Well... Why not just download my Compact Framework DLL, and forget doing the
decoding? It is free. Look for DecodeGPS on my Software Downloads page.

Dick

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
Sounds like the serial speed may be incorrect. 4800 bps is standard.

--
Richard Grier (Microsoft Visual Basic MVP)

See www.hardandsoftware.net for contact information.

Author of Visual Basic Programmer's Guide to Serial Communications, 3rd
Edition ISBN 1-890422-27-4 (391 pages) published February 2002.
 
Back
Top