Results 1 to 8 of 8

Thread: how to isolate GPS data into pieces?

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    Atlanta, GA
    Posts
    13

    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:
    1. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
    2.         AxMSComm1.PortOpen = True
    3.         Button1.Text = "OPENED"
    4.        
    5.     End Sub
    6.  
    7.    
    8.     Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
    9.         Dim gpsdata As String
    10.         Dim txtFilter As String
    11.         gpsdata = AxMSComm1.Input
    12.         TextBox1.Text = gpsdata
    13.         txtFilter = Mid(gpsdata, 1, 6)
    14.         Select Case (txtFilter)
    15.             Case "$GPRMC"
    16.                 TextBox2.Text = Mid(gpsdata, 8, 6)  'GPS Time
    17.                 TextBox3.Text = Mid(gpsdata, 21, 4) 'Latitude
    18.                 TextBox4.Text = Mid(gpsdata, 30, 4) 'Longitude
    19.                 'first, I want to make sure the above 3 boxes
    20.                 'get the right data.
    21.  
    22.                 'More data (other 2 boxes)will be implement later on
    23.                 'textbox5 - later
    24.                 'textbox6 - later
    25.  
    26.         End Select
    27.     End Sub
    28. End Class
    Last edited by cxiong; Aug 28th, 2006 at 09:27 AM.
    cxiong

  2. #2

  3. #3
    Member chocoloco's Avatar
    Join Date
    Mar 2006
    Posts
    42

    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

  4. #4

    Thread Starter
    New Member
    Join Date
    May 2001
    Location
    Atlanta, GA
    Posts
    13

    Re: how to isolate GPS data into pieces?

    what is coding convention?
    cxiong

  5. #5
    Member chocoloco's Avatar
    Join Date
    Mar 2006
    Posts
    42

    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.

  6. #6
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    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.

  7. #7
    I'm about to be a PowerPoster!
    Join Date
    Jan 2005
    Location
    Everywhere
    Posts
    13,647

    Re: how to isolate GPS data into pieces?

    Quote Originally Posted by cxiong
    what is coding convention?
    I nearly choked on my drink.

  8. #8
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    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
  •  



Click Here to Expand Forum to Full Width