B-1
Appendix B. Serial Programming
Serial programming allows the retrieval of all values of GPRMC and GPGGA
values. The
GPS()
instruction is a subset of the values that are available.
CRBasic Example B-1. Reading the GPS Using Serial Programming
'GPS16X-HVS at Campbell Scientific Factory Defaults
Const GPSPort = Com4
'Com port where GPS is connected
Public
GGAstring
As
String
* 500
Public
RMCstring
As
String
* 500
'rmc variables
Public
rmcid
As
String
Public
rmcutc
As
String
Public
rmcstatus
As
String
Public
rmclatitude
As
String
Public
rmcin_s_ind
As
String
Public
rmclongitude
As
String
Public
rmce_w_indicator
As
String
Public
rmcspeed
As
String
Public
rmccourse
As
String
Public
rmcutcdate
As
String
Public
rmcmagvariation
As
String
Public
rmcmage_w
As
String
Public
rmcchecksum
As
String
'gga variables
Public
ggaid
As
String
Public
ggautc
As
String
Public
ggailatitude
As
String
Public
ggan_s_ind
As
String
Public
ggalongitude
As
String
Public
ggae_w_ind As
String
Public
ggapositionfix
As
String
Public
gganumsatellites
As
String
Public
ggahdop
As
String
Public
ggaaltitude
As
String
Public
ggaaltutudeunits
As
String
Public
ggageoidsep
As
String
Public
ggageoidunits
As
String
Public
ggachecksum
As
String
Dim
NBytesReturned
As
Long
Dim
SubStrings(16)
As
String
* 32, rawdata
As
String
* 500
Dim
CalculatedChecksum
As
Long
, ReportedChecksum
As
Long
DataTable
(gpsdata,True,-1)
DataInterval
(0,1,Sec,10)
Sample
(1,rmcid,
String
)
Sample
(1,rmcutc,
String
)
Sample
(1,rmcstatus,
String
)
Sample
(1,rmclatitude,
String
)
Sample
(1,rmcin_s_ind,
String
)
Sample
(1,rmclongitude,
String
)
Sample
(1,rmcspeed,
String
)
Sample
(1,rmccourse,String)
Sample
(1,rmcutcdate,
String
)
Sample
(1,rmcmagvariation,
String
)
Sample
(1,rmcmage_w,
String
)
Sample
(1,rmcchecksum,
String
)
Sample
(1,ggaid,
String
)
Sample
(1,ggautc,
String
)
Sample
(1,ggan_s_ind,
String
)
Sample
(1,ggalongitude,
String
)
Sample
(1,ggae_w_ind,
String
)