DNA/DNR-IRIG-650 IRIG Timing Layer
Chapter 3
47
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.
The IRIG-650 API provides a simple way to synchronize time with GPS time.
First, set the Time Keeper to be driven from a 1PPS GPS clock (this clock is
available regardless of whether the GPS acquired satellites):
CT650_TKPPS_GPS
Second, allow handling GPS data by internal interrupt routine. This routine is
interrupted upon receiving each GPS NEMA string and keeps track of GPS
validity status:
ret = DqAdv650EnableGPSTracking(hd, devn, TRUE, &status);
Third, make sure that inquiry about current GPS status in the loop to see that
antenna is OK.
Fourth, wait for GPS tracking data to become active (also take note that the
CT650_GPS_ACC_GPSFIXV
bit changes each 500ms); and when this flag is
set, call
DqAdv650SetGPSTime()
to force GPS time to be written to the
TimeKeeper registers by the interrupt service routine:
if (status & CT650_GPS_ACC_ACTIVE)
// If GPS reception
{
// is active
printf("GPS is active. Adjust board time to GPS time\n");
ret = DqAdv650SetGPSTime(hd, devn, flags, &status);
}
If time has been applied another GPS status bit will be set:
CT650_GPS_ACC_GPSAPPLIED
When it is set the timekeeper time matches GPS satellite time and is clocked by
GPS 1PPS pulses with 1µs accuracy.
3.2.7.2
Commanding
the GPS unit
The user can also program the GPS unit using NMEA commands:
int DAQLIB DqAdv650WriteGPS(int hd, int devn, uint32 mode, int
rq_size, char* data, int* copied)
NMEA commands are used to change or query settings of the module.
Command Length
:
The maximum length of each packet is restricted to 255 bytes
Commands Contents
:
Preamble: One byte character; quoted below.
„
$
‟
NMEA ID: This will identify for the NMEA parser that it is command for MediaTek.
Four byte character string.
“
PMTK
”
Command Number: Three byte character string.
From “
000
” to “
999
”
An identifier used to tell the decoder how to decode the command