Overview
  Next

The GPS library decodes a standard NMEA 0183 string received from the GPS receiver.
The main function of this library is GPSStream.
This function receives the string received from the GPS and when the string includes enough data it updates all the properties and raises the GPSDecoded event.
Using the Converter library which is also included in this library you can convert geographic coordinates from Lat/Lon format to UTM format (and vice versa) and from different datums.
The GPS library decodes the GPRMC and the GPGGA sentences.
If you need to decode other sentences you can use the StrSplit method which will split a string into words.
The data from the GPS is received using the Serial library and the InputString method.
The following example demonstrates the most straightforward way to handle the GPS data.

Example: Add a GPS object named gps, a Serial object named Serial and a Converter object named converter.

Sub Globals
      dim ll(0) as double, utm(0) as double
End Sub

Sub App_Start
      Form1.Show
      If cppc = true then port = 8 else port = 5 'Change it to fit your ports numbers.
      Serial.New2(port,9600,"N",8,1)
      Serial.PortOpen = true
      gps.New1
      converter.New1
      AddTimer("Timer1")
      Timer1.Interval = 1000
      Timer1.Enabled = true
End Sub

Sub Timer1_Tick
      if Serial.InBufferCount>0 then
            gps.GPSStream(Serial.InputString)
      end if
End Sub

Sub GPS_GPSDecoded
      ListBox1.Clear
      ListBox1.add("status: "& gps.status)
      ListBox1.Add("Number Of Satellites: " & gps.NumberOfSatellites)
      ListBox1.Add("Time: " & gps.UTCTime)
      ListBox1.add("lat: " & gps.latitude)
      ListBox1.add("lon: " & gps.longitude)
      ListBox1.add("dlat: "& gps.DecimalLatitude)
      ListBox1.Add("dlon: " & gps.DecimalLongitude)
      ListBox1.add("speed: "& gps.speedoverground)
      utm() = Converter.WGS84LatLonToUTM(gps.DecimalLatitude,gps.DecimalLongitude)
      ListBox1.Add("XZone: " & utm(0))
      ListBox1.Add("UTMX: " & utm(1))
      ListBox1.Add("YZone: " & chr(utm(2)))
      ListBox1.Add("UTMY: " & utm(3))
End Sub