User manual

Chapter 3 Software Overview
NI-DAQ User Manual for PC Compatibles 3-96 ni.com
Clock Synchronization
Clocks can be synchronized using an external source. Currently, there are
two supported types of synchronizationPulse Per Second (PPS), and
IRIG B.
Pulse Per Second
PPS, the simplest type of synchronization, is a very accurate 1 Hz signal.
Depending on your satellite receiver, the accuracy of this signal can vary
from 300 to 100 ns. The disadvantage of PPS is that no absolute timing
information is encoded in the pulse, so you must set the initial time of the
clock. After that, the PPS keeps the subsecond counters synchronized.
The initial time for NI-TIO clocks is specified in seconds from 12:00 a.m.,
January 1 of the current year. You can think of this as Julian seconds if it
is easier. Most GPS receivers produce a PPS stream.
You must allow for a window of error when using PPS. When you receive
the time from the receiver, you must set the clock up within 1 second. If
you wait any longer, your clock will be off by 1 or more seconds. The
SetUpClockUsingPPS section shows pseudocode for ensuring that your
clock has been set safely.
SetUpClockUsingPPS
Comment: Get the latest time from the RS-232 port of the
receiver. It has a Comment: resolution of one second.
initialTime = Satellite Receiver Time
lastTime = initialTime
Comment: This is for initialization.
While (initialTime = lastTime)
{
Comment: Get the latest time.
lastTime = Satellite Receiver Time
}
Comment: We now are at the beginning of the next second.
Comment: This will minimize the chance of taking too long
Comment: to program the clock.
GPCTR_Control(deviceNumber, ND_CLOCK_x, ND_RESET)
GPCTR_Set_Application(deviceNumber, ND_CLOCK_x,
ND_SIMPLE_TIME_MSR)