Synchronizing acquisition Data with different devices CDAQ 9178 and NI USB 6009 and different rates

7 views (last 30 days)
Hello, I need for my project to acquire three channel at different frequencies on two different devices CDAQ 9178 and NI USB 6009 using the following script:
Dev ='CDAQ2';
d1 = daq('ni');
% voltage acquisition
DevTot = [Dev,'Mod7'];
ch4= addinput(d1,DevTot,"ai0","Voltage");
d1.Rate=1000;
d2 = daq('ni');
% current acquisition
DevTot='Dev1';
ch6= addinput(d2,DevTot,"ai0","Voltage");
% current acquisition
DevTot = [Dev,'Mod5'];
ch7= addinput(d2,DevTot,"ai0","Voltage");
d2.Rate = 100;
daqDuration=10;
% %Configure the source data acquisition object to export a triggering signal on the PFI0 terminal of cDAQ2 chassis
addtrigger(d1, 'Digital', 'StartTrigger', 'cDAQ2/PFI0', 'External');
%Configure the destination data acquisition object to start acquisition when an external triggering signal is received at PFI0 terminal of Dev1 chassis
addtrigger(d2, 'Digital', 'StartTrigger', 'External', 'Dev1/PFI0');
%Configure the destination data acquisition object to start acquisition when an external triggering signal is received at PFI0 terminal of cDAQ2 chassis (different frequencies)
addtrigger(d2, 'Digital', 'StartTrigger', 'External', 'CDAQ2/PFI0');
start(d2, 'Duration', daqDuration)
while ~d2.WaitingForDigitalTrigger
pause(0.1)
end
start(d1, 'Duration', daqDuration)
%Wait until data acquisition is complete
while d1.Running || d2.Running
pause(1)
end
data1 = read(d1, 'all');
data2 = read(d2, 'all');
I'd like to ask if for the syncronization of these three channel I need only to connect the BNC terminal of the CDAQ 9178 with the port29 of the NI USB 6009 (PFI0).

Answers (1)

Rijuta
Rijuta on 22 Feb 2023
Hi Nicolo’
I understand that you are seeking a way to synchronize data acquisition devices.
Yes, the synchronization of the data acquisition devices (NI cDAQ 9178 and NI USB 6009) can be achieved by connecting the BNC terminal of the cDAQ 9178 to the port 29 of the USB 6009. This will pass the trigger signal from the cDAQ 9178 to the USB 6009, allowing both devices to synchronize and acquire data simultaneously. Note that the PFI0 terminal on the USB 6009 must be set to receive the external trigger signal in the NI-MAX software, and the trigger signal on the cDAQ 9178 must be configured to generate a rising edge pulse.
For more information, please refer to the following documentation.

Categories

Find more on Simultaneous and Synchronized Operations in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!