2 example program using gps() instruction, Example program using gps() instruction – Campbell Scientific GPS16X-HVS GPS Receiver User Manual

Page 16

Advertising
background image

GPS16X-HVS GPS Receiver

the data table(s). This restriction does not apply to hardware

revisions 08 or greater.

NMEAStrings The NMEAStrings parameter is the string array that holds the

NMEA sentences. If it exists, the GPRMC sentence will reside

in NMEAStrings(1), and the GPGGA sentence will reside in

NMEAStrings(2). Any other sentences will reside in

subsequent indexes into the array (on a first-in basis). Once an

index in the array is used to store a particular sentence, that

sentence will always be stored in that location when updates to

the sentence are received.

5.2 Example Program Using GPS() Instruction

The following wiring and short program provide an example of using the

GPS() instruction with the Garmin GPS16X-HVS.

'Program the GPS16-HVS to use 38.4 kbaud, no parity, 8 data bits, and 1 stop bit
PipeLineMode

Const LOCAL_TIME_OFFSET = -6 'Local time offset relative to UTC time
Dim nmea_sentence(2) As String * 90

Public gps_data(15)
Alias gps_data(1) = latitude_a 'Degrees latitude (+ = North; - = South)
Alias gps_data(2) = latitude_b 'Minutes latitude
Alias gps_data(3) = longitude_a 'Degress longitude (+ = East; - = West)
Alias gps_data(4) = longitude_b 'Minutes longitude
Alias gps_data(5) = speed 'Speed
Alias gps_data(6) = course 'Course over ground
Alias gps_data(7) = magnetic_variation 'Magnetic variation from true north (+ =
'East; - = West)
Alias gps_data(8) = fix_quality 'GPS fix quality: 0 = invalid, 1 = GPS, 2 =
'differential GPS, 6 = estimated
Alias gps_data(9) = nmbr_satellites 'Number of satellites used for fix
Alias gps_data(10) = altitude 'Antenna altitude
Alias gps_data(11) = pps 'usec into sec of system clock when PPS
'rising edge occurs, typically 990,000 once
'synced
Alias gps_data(12) = dt_since_gprmc 'Time since last GPRMC string, normally less
'than 1 second
Alias gps_data(13) = gps_ready 'Counts from 0 to 10, 10 = ready
Alias gps_data(14) = max_clock_change 'Maximum value the clock was changed in msec
Alias gps_data(15) = nmbr_clock_change 'Number of times the clock was changed

'Define Units to be used in data file header
Units latitude_a = degrees
Units latitude_b = minutes
Units longitude_a = degrees
Units longitude_b = minutes
Units speed = m/s
Units course = degrees
Units magnetic_variation = unitless
Units fix_quality = unitless
Units nmbr_satellites = unitless
Units altitude = m

10

Advertising