Multiple-Device Synchronization Using USB or PXI Devices

You can synchronize multiple devices in a session using a shared scan clock and shared start trigger. You can synchronize devices using either PFI or RTSI lines.

Requirement

You must register your RTSI cable using the National Instruments® Measurement & Automation Explorer.

Acquire Synchronized Data Using USB Devices

This example shows how to acquire synchronized voltage data from multiple devices using a shared start trigger and a shared scan clock. Analog input channels on all three devices are connected to the same function generator.

Create a data acquisition session and add one voltage input channel from each device:

  • NI USB-6211 with device ID 'Dev1'

  • NI USB 6218 with device ID 'Dev2'

  • NI USB 6255 with device ID 'Dev3'

s = daq.createSession('ni');
addAnalogInputChannel(s,'Dev1',0,'Voltage');
addAnalogInputChannel(s,'Dev2',0,'Voltage');
addAnalogInputChannel(s,'Dev3',0,'Voltage');

Choose terminal 'PFI4' on 'Dev1' as the start trigger source. Connect the trigger source to terminal 'PFI0' on 'Dev2' and to 'PFI0' on 'Dev3', which are the destination devices.

addTriggerConnection(s,'Dev1/PFI4','Dev2/PFI0','StartTrigger');
addTriggerConnection(s,'Dev1/PFI4','Dev3/PFI0','StartTrigger');

Choose terminal 'PFI5' on 'Dev1' as the scan clock source. Connect it to 'PFI1' on 'Dev2', and to 'PFI1' on 'Dev3'.

s.addClockConnection('Dev1/PFI5','Dev2/PFI1','ScanClock');
s.addClockConnection('Dev1/PFI5','Dev3/PFI1','ScanClock')
ans =

Start Trigger is provided by 'Dev1' at 'PFI4' and will be received by:
         'Dev2' at terminal 'PFI0'
         'Dev3' at terminal 'PFI0'
Scan Clock is provided by 'Dev1' at 'PFI5' and will be received by:
         'Dev2' at terminal 'PFI1'
         'Dev3' at terminal 'PFI1'

   index     Type      Source   Destination
   ----- ------------ --------- -----------
   1     StartTrigger Dev1/PFI4 Dev2/PFI0
   2     StartTrigger Dev1/PFI4 Dev3/PFI0
   3     ScanClock    Dev1/PFI5 Dev2/PFI1
   4     ScanClock    Dev1/PFI5 Dev3/PFI1

Acquire data and assign it to dataIn.

dataIn = startForeground(s);

Plot the data.

plot(dataIn)

All channels are connected to the same function generator, and therefore display overlapping signals, indicating synchronization.

Synchronize Counter Outputs from Multiple Devices

This example shows how to synchronize the start trigger of counter output operations from two channels on different devices.

s = daq.createSession('ni');
addCounterOutputChannel(s,'Dev1','ctr0','PulseGeneration');
addCounterOutputChannel(s,'Dev2','ctr0','PulseGeneration');
addTriggerConnection(s,'Dev1/PFI0','Dev2/PFI0','StartTrigger');
startForeground(s)

This example uses two USB or PCI devices, but could be modified for channels across CompactDAQ or PXI chassis. If you have counter output CompactDAQ modules in the same chassis, it is not necessary to call addTriggerConnection; but it is required for multiple modules in the same PXI chassis.

Synchronize DSA PXI Devices Using AutoSyncDSA

This example shows how to acquire synchronized data from two Dynamic Signal Analyzer (DSA) PXI devices, NI PXI-4462 and NI PXI-4461, using the AutoSyncDSA property.

Create an acquisition session and add one voltage analog input channel from each of the two PXI devices

s = daq.createSession('ni');
addAnalogInputChannel(s,'PXI1Slot2',0,'Voltage');
addAnalogInputChannel(s,'PXI1Slot3',0,'Voltage');

Acquire data in the foreground without synchronizing the channels:

[data,time] = startForeground(s);
plot(time,data)

The data returned is not synchronized.

Synchronize the two channels using the AutoSyncDSA property:

s.AutoSyncDSA = true;

Acquire data in the foreground and plot it:

[data,time] = startForeground(s);
plot(time, data)

The data is now synchronized.

Acquire Synchronized Data Using PXI Devices

This example shows how to acquire voltage data from two PXI devices on the same chassis, using a shared start trigger to synchronize operations within your session. PXI devices have a shared reference clock that automatically synchronizes scan clocking. You need to add only start trigger connections to synchronize operations in your session with PXI devices. Analog input channels on all devices are connected to the same function generator.

Create a data acquisition session and add one voltage input channel from each NI-PXI 4461 device with IDs 'PXI1Slot2' and 'PXI1Slot3'.

s = daq.createSession('ni');
addAnalogInputChannel(s,'PXI1Slot2',0,'Voltage');
addAnalogInputChannel(s,'PXI1Slot3',0,'Voltage');

Add a start trigger connection to terminal 'PXI_Trig0' on 'PXI1Slot2' and connect it to terminal 'PXI_Trig0' on 'PXI1Slot3'. PXI cards are connected through the backplane, so you do not have to wire them physically.

addTriggerConnection(s,'PXI1Slot2/PXI_Trig0','PXI1Slot3/PXI_Trig0','StartTrigger');

Acquire data and assign it to dataIn.

dataIn = startForeground(s);

Plot the data.

plot(dataIn)

All channels are connected to the same function generator and have a shared reference clock. The signals overlap, indicating perfect synchronization.

Related Topics