User manual

Chapter 3 Software Overview
NI-DAQ User Manual for PC Compatibles 3-100 ni.com
UseCase#2
The user records the time of a single event on two physically distributed
data acquisition systems with hardware timing precision.
A user wants to record how a lightning strike at a power grid in city A
travels to a grid station in city B. The lightning sensors in both cities
produce a TTL pulse upon receiving the lightning bolt in city A.
Another user wants to correlate buffered analog input measurements across
distributed data acquisition systems. He connects a GPS receiver to an
NI-TIO device on each system and connects the scan clock to the gate input
of the clock. The first active edge on the scan clock on each system will
record the global time that sample was taken. The user can use the sample
rate on each system to calculate the absolute time each sample was taken,
assuming sample rates remain constant throughout the experiment.
The software program flow is as follows:
1. Initialize the clock for this application.
Specify the synchronization signal source (PFI line, RTSI line).
Specify the synchronization method.
If source is PPS, read the current time from the GPS receiver
via a serial port and set it as the initial DHMS value of the
clock, or choose any arbitrary value. Initialization will take
about 2 seconds.
If source is IRIG-B, simply wait for 2 seconds after
programming the hardware. The clock will automatically
synchronize to the GPS signal.
Specify gate signal source and polarity.
Clock value automatically latches upon receiving the first pulse
on its gate input.
2. Poll the armed attribute of the clock until it is disarmed (when the
external event happens). The clock is always armed in hardware, but
the software abstraction of the clock will be unarmed after it latches
the first point.
3. Read the clock value (days, hours, minutes, seconds) to determine the
time of the external event.
4. At the end of the operation, free up any hardware and software
resources. After powering up, the clock will run until the power to
the TIO ASIC is turned off.