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.


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

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.

Was this topic helpful?