This example shows how to acquire synchronized data from two PCI devices. A sine wave is connected to channel 0 of NI PCI-6251 and to channel 0 of NI PCIe-6363. Synchronized operation is verified by demonstrating zero phase lag between the acquired signals.
Create a DataAcquisition and add analog input voltage input channels from NI PCI-6251 and NI PCIe-6363 devices.
dd = daq("ni"); addinput(dd,"Dev3","ai0","Voltage"); addinput(dd,"Dev4","ai0","Voltage");
read command to start the acquisition.
[data,time] = read(dd,seconds(1),"OutputFormat","Matrix"); plot(time, data)
There is a small phase lag between the two channel inputs. The DataAcquisition starts the two channels close together, but the devices do not share any clock and trigger information and therefore are not fully synchronized.
Connect PCI devices using a RTSI® (Real-Time System Integration) cable and register it in Measurement & Automation Explorer®. To synchronize the acquisition, share a scan clock and start trigger between the two devices.
Choose Source and Destination Devices
The device that provides the control and timing signals is called the source device, and the device that receives these signals is called destination device. In this example,
Dev3 is the source device and
Dev4 is the destination device.
The RTSI cable creates a physical connection between the
RTSI0 terminal on
RTSI0 terminal on
Dev4. Use this connection to share the start trigger between the source and destination devices.
addtrigger to add a digital start trigger from
'RTSI0/PFI3' (source) to
addclock to share a scan clock using the
RTSI1 terminal connection.
read to acquire data.
[data,time] = read(dd,seconds(1)); plot(time,data)
The two sine waves are overlapping with zero phase lag, confirming that the devices are fully synchronized.