Figure 1
Figure 1 Global Positioning Codes
RMC - GPS/Transit Data |
Example: $GPRMC,180258,A,4056.4604,N,07216.9673,W,3.965,263.0,130800, 14.8,W*41 Fields: Time of fix (hhmmss), Status (A=OK, V=warning), latitude, N/S, longitude, E/W, ground speed (knots), course, date of fix (ddmmyy), magnetic variation, E/W, checksum |
GGA - Global Positioning Fix Data |
Example: $GPGGA,180300,4056.4602,N,07216.9702,W,1,06,1.34,8.4,M, -34.6,M,,*43 Fields: Time of fix (hhmmss), latitude, N/S, longitude, E/W, Quality (0=invalid, 1=GPS fix, 2=DGPS fix), number of satellites tracked, horizontal dilution of position, altitude, M (for meters), height of geoid above WGS84 ellipsoid, seconds since last DGPS update, DGPS station ID, checksum |
GSA - Active Satellites and Dilution of Precision |
Example: $GPGSA,A,3,17,23,09,29,26,,,,,,,,2.48,1.34,2.09*00 Fields: Selection of 2D/3D fix (A=automatic, M=manual), Fix type (2=2D, 3=3D), pseudo-random number (PRN) ID of satellites, position dilution of precision (PDOP), horizontal dilution of precision (HDOP), vertical dilution of precision (VDOP), checksum |
GSV - Satellites in View |
Example: $GPGSV,3,2,09,21,21,298,33,15,18,319,28,29,16,246,36,03, 10,299,28*7D Fields: Number of GSV sentences in this group, number of this sentence, number of satellites in view, satellite PRN, elevation, azimuth, signal strength (all repeated up to four times per sentence), checksum |
Figure 2 CommCheck
Dim flag ' Is input currently being read?
Dim strUnparsed As String ' All the input data that needs to be broken into
' phrases
Private Sub btnGo_Click()
If flag = 0 Then ' you're turning on input
If MSComm1.PortOpen = False Then
MSComm1.CommPort = 1
MSComm1.Settings = "4800,N,8,1"
MSComm1.PortOpen = True
End If
flag = 1
txtDisplay.Text = ""
btnGo.Caption = "Stop"
Else ' you're turning off input
flag = 0
If MSComm1.PortOpen = True Then MSComm1.PortOpen = False
btnGo.Caption = "Go"
End If
End Sub
Private Sub Form_Load()
flag = 0
Timer1.Interval = 1000 ' Every second, poll the GPS device
End Sub
Private Sub Timer1_Timer()
If flag = 1 Then
FetchInput
ParseInput
End If
End Sub
Sub FetchInput()
On Error Resume Next
If flag = 1 Then ' Only parse while comm port is open
b$ = MSComm1.Input
strUnparsed = strUnparsed + b$
End If
End Sub
Sub ParseInput() ' Only parse complete phrases
Dim strCurrent As String ' All the input data in the current string
Dim crpos As Integer
If Len(strUnparsed) = 0 Then Exit Sub ' Nothing new to parse!
crpos = InStr(1, strUnparsed, vbCr) ' Find the EOL in the current input
Do While crpos > 0 ' Loop thru the current input, breaking phrases at EOLs
strCurrent = Left(strUnparsed, crpos - 1)
strUnparsed = Mid(strUnparsed, crpos + 2)
crpos = InStr(1, strUnparsed, vbCr)
' Add current input to the textbox
txtDisplay.Text = txtDisplay.Text & strCurrent & vbCrLf
' If the textbox is getting long, only show the last 1500 chars
If Len(txtDisplay.Text) > 1500 Then txtDisplay.Text = _
Right(txtDisplay.Text, 1500)
' Move the selection to the end of the textbox
txtDisplay.SelStart = Len(txtDisplay.Text)
Loop
End Sub
Figure 4 TripMate Initialization Codes
PRWIINIT - TripMate Initialization |
Example: $PRWIINIT,V,,,3338.6000,N,11155.0000,W,0,0,M,0,T, 190500,021000 Fields: Status (A=cycle unit off, V=init string), null, null, null, latitude, N/S, longitude, E/W, speed, altitude, M, bearing, compass true? (T=true),date (ddmmyy),GMT (hhmmss) |
PRWIILOG - Request Specific Strings Only |
Example: $PRWIILOG,RMC,A,T,1,0 Fields: Message to turn on/off, status (A=string on, V=off), T, interval in seconds, 0 |
Figure 5 Plotting Satellites
Sub PlotSat(satelev As Integer, satazim As Integer)
Dim x, y
pi = 3.14159265358979
' Correct so that N = up
satazim = (satazim - 90) Mod 360
x = 180 + satelev * Cos((satazim * pi / 180))
y = 180 + satelev * Sin((satazim * pi / 180))
picCompass.ForeColor = RGB(255, 0, 0)
picCompass.PSet (x, y), RGB(255, 0, 0)
End Sub