Technical Note: GPS OCX (SylvanGPS.ocx)

In version 4.2 we have added a simple NMEA GPS OCX you can use to work with most serial GPS receivers. It reads standard NMEA messages from the GPS and fires an event whenever a new GPS fix is available.

Properties:

Altitude: (Variant) Altitude in meters if the GPS provides this information.

BaudRate: (Variant String) A string containing the serial port line speed of the GPS. This causes the serial port to be set to this speed. Match this to the GPS serial port speed. The default is 4800 bps.

CommPort: (Variant) The COMM port the GPS unit is attached to. Default is 1.

CourseMadeGood (Variant) Direction of travel, decimal degrees if available.

DateOfFix (Variant String) Date of the fix, DDMMYY

GroundSpeed (Variant) Speed of travel over the ground, in Knots, if available.

Latitude (Variant Double) Latitude in Decimal Degrees.

Longitude (Variant Double) Longitude in Decimal Degrees.

MagneticVariation (Variant) Magnetic Variation in decimal degrees, if available.

MagneticVariationDirection (Variant) Magnetic Variation Direction in degrees, if available.

NavigationReceiverWarning (Variant) Set to A=OK or V=warning, 0 = bad, 1=GPS, 2=DGPS

TimeOfFix (Variant) GMT Time of Fix

 

Methods:

CloseGPSPort Closes the serial port and stops reading the GPS device.

OpenGPSPort Opens the serial port and starts reading the GPS device.

 

Events:

NewGPSFixAvailable Fired when the GPS issues a new fix.

 

Example:

'This example has a SylvanGPS OCX, two buttons, Command1 and Command2. It also has four text boxes, Text1, Text2, Text3, Text 4. Command1 starts the GPS, Command2 stops it. The four text boxes display Latitude, Longitude, TimeOfFix and Altitude.

Private Sub Command1_Click()

SimpleGPS1.CommPort = 2

SimpleGPS1.BaudRate = "9600"

SimpleGPS1.OpenGPSPort

End Sub

 

Private Sub Command2_Click()

SimpleGPS1.CloseGPSPort

End Sub

 

Private Sub SimpleGPS1_NewGPSFixAvailable()

Text1 = SimpleGPS1.Latitude

Text2 = SimpleGPS1.Longitude

Text3 = SimpleGPS1.TimeOfFix

Text4 = SimpleGPS1.Altitude

End Sub