Documentation

Multiple-Device Synchronization

You can synchronize multiple devices in a session using a shared clock and 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 trigger and a shared clock. Analog input channels on all three devices are connected to the same function generator.

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

  • 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 trigger source. Connect the trigger source to terminal 'PFI0' on 'Dev2' and 'PFI0' on 'Dev3', which are the destination devices.

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

Chose terminal 'PFI5' on 'Dev1' as the clock source. Connect it to 'PFI1' on 'Dev2' and '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 store it in dataIn.

dataIn = startForeground(s); 

Plot the data.

plot (dataIn)

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

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 trigger to synchronize operations within your session. PXI devices have a shared reference clock that automatically synchronizes clocking. You only need to add 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 channels. Add one voltage input channel each from both NI-PXI 4461 devices with IDs 'PXI1Slot2' and 'PXI1Slot3'.

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

Add a 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 store it in 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 are therefore overlapping, which shows perfect synchronization.

Was this topic helpful?