Garmin GPS 16HVS Instruction Manual - Page 9

CRBasic Programming

Page 9 highlights

Garmin 16-HVS GPS Receiver Warm Start One satellite in use, time from GPS Real Time Clock (not GPS), no position: $GPGGA,183806.0,,,,,0,01,,,,,,,*7D Valid GPS Fix Three satellites acquired, time and position valid: $GPGGA,005322.0,4147.603,N,11150.978,W,1,03,11.9,00016,M,016,M,,*6E If the almanac and ephemeris data are not stored in the non-volatile data, GPS acquisition time is less than 5 minutes. If only the ephemeris data are unknown, acquisition time is less than 45 seconds. If all data are known (warm start), GPS acquisition time is less than 15 seconds. 4. CRBasic Programming CRBasic is used to write programs for the CR1000, CR3000, CR800, and CR850 dataloggers. These dataloggers use several instructions to read GPS output, which is asynchronous serial data. As shipped from Campbell Scientific, the GPS receiver will output data once a second, 1200 baud, 8 data bits, no parity, and 1 stop bit. Only the GPGGA string is output. See Section 3 for details on the GPGGA string. See Appendix D for specifics on changing the GPS receiver setups, including using higher baud rates, which the CR1000, CR3000, CR800, and CR850 support. 4.1 Read GPS Data 4.1.1 SerialOpen SerialOpen is used to open the appropriate serial port, specify the baud rate, data format, etc. Any of the six serial ports may be used, but option codes 3, 4 and 5 are not used in this application. Data format is zero, TX delay is zero, buffer size should be about 2000, which is large enough to prevent the GPGGA string from overrunning the buffer before data is read by the SerialIn instruction. If memory is limited, the buffer size can be smaller. Example: SerialOpen (com1,1200,0,0,2000) 4.1.2 SerialIn The SerialIn instruction removes data from the buffer declared in the SerialOpen instruction and places the data in a variable of type string. Use a timeout of 20, a termination character of 13, and maximum number of characters of 100, or 1 less than the size of the destination variable. Declare a string variable of size 101 before using SerialIn. Example: Public GPSdata as string * 101 Example: SerialIn (GPSData,com1,20,13,100) 4.1.3 SerialFlush The SerialFlush instruction is used to clear all data from the buffer associated with the serial port. 5

  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30

Garmin 16-HVS GPS Receiver
Warm Start
One satellite in use, time from GPS Real Time Clock (not GPS), no position:
$GPGGA,183806.0,,,,,0,01,,,,,,,*7D
Valid GPS Fix
Three satellites acquired, time and position valid:
$GPGGA,005322.0,4147.603,N,11150.978,W,1,03,11.9,00016,M,-
016,M,,*6E
If the almanac and ephemeris data are not stored in the non-volatile data, GPS
acquisition time is less than 5 minutes.
If only the ephemeris data are
unknown, acquisition time is less than 45 seconds.
If all data are known
(warm start), GPS acquisition time is less than 15 seconds.
4.
CRBasic Programming
CRBasic is used to write programs for the CR1000, CR3000, CR800, and
CR850 dataloggers.
These dataloggers use several instructions to read GPS
output, which is asynchronous serial data.
As shipped from Campbell
Scientific, the GPS receiver will output data once a second, 1200 baud, 8 data
bits, no parity, and 1 stop bit.
Only the GPGGA string is output.
See Section
3 for details on the GPGGA string.
See Appendix D for specifics on changing
the GPS receiver setups, including using higher baud rates, which the CR1000,
CR3000, CR800, and CR850 support.
4.1
Read GPS Data
4.1.1
SerialOpen
SerialOpen is used to open the appropriate serial port, specify the baud rate,
data format, etc.
Any of the six serial ports may be used, but option codes 3, 4
and 5 are not used in this application.
Data format is zero, TX delay is zero,
buffer size should be about 2000, which is large enough to prevent the
GPGGA string from overrunning the buffer before data is read by the SerialIn
instruction.
If memory is limited, the buffer size can be smaller.
Example: SerialOpen (com1,1200,0,0,2000)
4.1.2
SerialIn
The SerialIn instruction removes data from the buffer declared in the
SerialOpen instruction and places the data in a variable of type string.
Use a
timeout of 20, a termination character of 13, and maximum number of
characters of 100, or 1 less than the size of the destination variable.
Declare a
string variable of size 101 before using SerialIn.
Example: Public GPSdata as string * 101
Example: SerialIn (GPSData,com1,20,13,100)
4.1.3
SerialFlush
The SerialFlush instruction is used to clear all data from the buffer associated
with the serial port.
5