DNA/DNR-IRIG-650 IRIG Timing Layer
Chapter 3
44
Programming with the Low Level API
Tel: 508-921-4600
www.ueidaq.com
Vers:
4.6
Date: March 2019
DNx-IRIG-650 Chap3x.fm
© Copyright 2019
United Electronic Industries, Inc.
3.2.7
GPS
programming
The
Fastrax IT500 Series GPS module is enabled upon power-up of IRIG-650
board to give it extra time to acquire satellites.
The GPS module has status and control registers and FIFO-based self-cleaning
serial interface which deletes the oldest characters when new data becomes
available. Thus when the GPS FIFO is read, it always returns the latest data.
The simplest way to get GPS information is to call
DqAdv650GetGPSStatus()
and
DqAdv650ReadGPS()
in a loop. Serial data is stored into the FIFO by the
GPS module every second.
while(!stop) {
ret = DqAdv650GetGPSStatus(hd, devn, mode, &gps_status,
&status, &time, &date);
printf("GPS status: %x\n", status);
ret = DqAdv650ReadGPS(hd, devn, mode, rq_size, data,
&ret_size);
data[ret_size] = 0; data[255] = 0;
printf("%s", data);
Sleep(1000);
}
3.2.7.1
Retrieving
GPS data
The function
DqAdv650GetGPSStatus
returns the status of GPS receiver as:
// These bits are returned as gsp_status in
DqAdv650GetGPSStatus()
CT650_GPS_ACC_GPSANTSHRT
=1 if antenna is shorted
CT650_GPS_ACC_GPSANTOK
=1 if antenna detected by the GPS
CT650_GPS_ACC_GPSRXD1
Current value of GPS RXD1 pin
CT650_GPS_ACC_GPSTXD1
Current value of GPS TXD1 pin
CT650_GPS_ACC_GPSRXD0
Current value of GPS RXD0 pin
CT650_GPS_ACC_GPSTXD0
Current value of GPS TXD0 pin
CT650_GPS_ACC_GPSFIXV
Fix valid output from GPS;
carries 0.5Hz square wave
when GPS fixes it's position
CT650_GPS_ACC_GPSAPPLIED
Time is set to GPS time
CT650_GPS_ACC_SATNUM
number of satellites tracked
CT650_GPS_ACC_ACTIVE
GPS tracking is activated
The function
DqAdv650ReadGPS
returns a variety of GPS information:
GGA - Global Positioning System Fix Data
Time, position and fix related data for a GPS receiver
$GPGGA,114353.000,6016.3245,N,02458.3270,E,1,10,0.81,35.2,
M,19.5,M,,*50
Format:
$GPGGA,hhmmss.dd,xxmm.dddd,<N|S>
,yyymm.dddd,<E|W>,v,ss,d.d,h.h,M
,g.g,M,a.a,xxxx*hh<CR><LF>
hhmmss.dd
UTC time of the fix. hh = hours mm = minutes ss = seconds
dd = decimal part of seconds