Overview
There are many examples that ship with LabVIEW and NI Scope for acquiring data, but what if you need to overwrite the standard timestamp with a timestamp from a GPS signal. This could be for a variety of reasons, including that the acquisitions are happening in quick succession but over a number of distributed systems, which would mean you need a very accurate timestamp on each system in order to be able to read them back in the correct order during offline analysis.
Description
The 2 attached examples export the start trigger for the scope acquisition from the NI Scope module (see hardware section below for details on which NI Scope module to use) to the PXI backplane on PXI_trig0, and the NI GPS Timing and Synchronisation card (PXI-6682 or PXIe-6683H - referred to as the GPS module for the rest of this article) is set up to trigger from PXI_trig0. Everytime the GPS module triggers it will grab an accurate timestamp and pass it back to LabVIEW. We then overwrite the timestamp in the NI Scope read cluster with the more accurate timestamp.
If the GPS module does not have a valid GPS signal it will read the timestamp from the PXI system clock. This could be due to adverse weather conditions preventing the GPS antenna from being able to pick up the satelites, or there may not have been enough time from system start up to get a full GPS packet (GPS packets are 30 seconds long so it will take at least 30 seconds to lock on, probably more).
Steps to run "niScope Real Timestamp - Write to TDMS.vi"
This example will grab the time domain data from the NI scope module each time it is triggered, and then perform a software FFT on each channel of data. The time domain data, FFT data and GPS timestamp are then sent via a queue to the file IO loop where it is all logged to a TDMS file.
Steps to run "niScope EX OSP Downconversion with Real Timestamp.vi"
This example has to be run on a PXI Scope module with OSP - such as a PXI-5142. Each time round the bottom loop the code sets up a grab and acquires a waveform of time domain data when the Analog Trigger is set. The trigger is again exported to PXI_trig0 and picked up by the GPS module. For every acquisition of data the onboard signal processing is used to downconvert the data by mixing it with a centre frequency as defined in the control "Centre Frequency". The Read Measurement function then passes back a hardware calculated FFT cluster.
The timestamp is then used to overwrite the timestamp in the time domain waveform before the time domain data and FFT data are passed via a queue to the file IO loop where they are logged to a file.
Requirements
Software
LabVIEW 2013
NI Scope
NI Sync
Hardware
PXI chassis and controller
PXI-5142 (or other NI Scope module for the non OSP example) with input signal
PXI-6682 or PXIe-6683H with valid GPS signal.
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.