|
-
Aug 28th, 2006, 09:24 AM
#1
Thread Starter
New Member
how to isolate GPS data into pieces?
I have the GPS data received as:
$GPRMC,040302.663,A,3939.7,N,10506.6,W,0.27,358.86,200804,,*1A
I want to isolate the GPS sentence into individual piece so I can display it into a textbox in a form with the following:
GPSTime:
Latitude:
Longitude:
Velocity:
Heading:
First thing is I need to detect the incoming text $GPRMC, if the $GPRMC is valid then use the data,
Who can I do that? I try to use the select case but it does not work.
Can anybody help me out?
Here is my code:
VB Code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
AxMSComm1.PortOpen = True
Button1.Text = "OPENED"
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Dim gpsdata As String
Dim txtFilter As String
gpsdata = AxMSComm1.Input
TextBox1.Text = gpsdata
txtFilter = Mid(gpsdata, 1, 6)
Select Case (txtFilter)
Case "$GPRMC"
TextBox2.Text = Mid(gpsdata, 8, 6) 'GPS Time
TextBox3.Text = Mid(gpsdata, 21, 4) 'Latitude
TextBox4.Text = Mid(gpsdata, 30, 4) 'Longitude
'first, I want to make sure the above 3 boxes
'get the right data.
'More data (other 2 boxes)will be implement later on
'textbox5 - later
'textbox6 - later
End Select
End Sub
End Class
Last edited by cxiong; Aug 28th, 2006 at 09:27 AM.
cxiong
-
Aug 28th, 2006, 09:27 AM
#2
Re: how to isolate GPS data into pieces?
-
Aug 28th, 2006, 09:45 AM
#3
Member
Re: how to isolate GPS data into pieces?
Yes, you can follow c0ding conventions ... if you do not have, talk to wossy. He gibs gud c0d.
BTW - You've just opened pandora's box
-
Aug 28th, 2006, 09:53 AM
#4
Thread Starter
New Member
Re: how to isolate GPS data into pieces?
what is coding convention?
-
Aug 28th, 2006, 09:55 AM
#5
Member
Re: how to isolate GPS data into pieces?
its the way you builld your life architecture. Check the link posted by BushMobile or talk to wossy.
-
Aug 28th, 2006, 11:21 AM
#6
Re: how to isolate GPS data into pieces?
Just split() on commas and select case the first element.
Also, find a good source of info on NMEA sentences like the one you posted.
I don't live here any more.
-
Aug 28th, 2006, 11:22 AM
#7
Re: how to isolate GPS data into pieces?
 Originally Posted by cxiong
what is coding convention?
I nearly choked on my drink.
-
Aug 28th, 2006, 11:33 AM
#8
Re: how to isolate GPS data into pieces?
$gprmc,040302.663,a,3939.7,n,10506.6,w,0.27,358.86,200804,,*1a
time is the 2nd field
lat is 4th and 5th
long is 6th and 7th
speed is 8th
heading (from true north) is 9th.
You need to validate the checksum too, otherwise your data will be unreliable. I can't be bothered goin into detail on that because this is the wrong forum.
I don't live here any more.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|