From 11:00 PM CDT Friday, Nov 8 - 2:30 PM CDT Saturday, Nov 9, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Two DAQ triggering in Matlab

Solved!
Go to solution

i want to triggering (synchronizing) Two different DAQ device (PCIE 6321 and PCIE 6351).

PCIE 6321 read data from photodiode 1 and PCIE 6351 read analog input data from photodiode 2.


In more detail, i want to start read data at PCIE 6351 when PCIE 6321 start measuring. (PCIE 6321 measure start -> trigger from PCIE 6321 act as trigger input to PCIE 6351 -> start measure PCIE 6351).

 

as triger source, i used counter output at PCIE 6321. And PCIE 6351 recieves this counter output. two DAQ connect through BNC cable and BNC 2110 board (two DAQ card connects two bnc 2110 respectivley) physically (PFI 12 at PCIE 6321 and PFI 0 at PCIE 6351)


but when i start matlab code, this warning message appears.

Warning : Clock Connections will not affect counter output channels.

this is my matlab code

d = daq.createSession('ni');
addAnalogInputChannel(d, 'Dev6', [0, 1], 'Voltage');

ch_6321 = d.Channels;
ch_6321(1).TerminalConfig = 'Differential';
ch_6321(2).TerminalConfig = 'Differential';
ch_6321(1).Range = [-5, 5];
ch_6321(2).Range = [-5, 5];
num_ch_6321 = size(ch_6321,2);

% Add counter output channel (Dev6) - Configure for single pulse generation
addCounterOutputChannel(d, 'Dev6', 'ctr0', 'PulseGeneration');
d.Channels(end).Frequency = 1000; % Frequency is irrelevant for single pulse, set high
d.Channels(end).DutyCycle = 0.1; % Pulse duration (very short pulse)
d.Channels(end).InitialDelay = 0; % No initial delay, start immediately

% Configure for single pulse
d.IsContinuous = false; % Disable continuous mode (single pulse only)

% DAQ-6321 sampling rate and duration configuration
d.Rate = 250000/num_ch_6321; % Sample rate = 250000 / number of Input Channel
d.DurationInSeconds = ceil((Nframes + 1) / refreshRate * waitframes) + 2;
d.NotifyWhenDataAvailableExceeds = d.NumberOfScans;
d

lh_6321 = d.addlistener('DataAvailable', @passData1);

% DAQ-6351
s = daq.createSession('ni');
addAnalogInputChannel(s, 'Dev8', [0, 1], 'Voltage');
ch_6351 = s.Channels;
ch_6351(1).TerminalConfig = 'Differential';
ch_6351(2).TerminalConfig = 'Differential';
ch_6351(1).Range = [-5, 5];
ch_6351(2).Range = [-5, 5];

num_ch_6351 = size(ch_6351,2);

s.Rate = 1000000/num_ch_6351; % Sample rate = 1000000 / number of Input Channel
s.DurationInSeconds = ceil((Nframes + 1) / refreshRate * waitframes) + 2;
s.NotifyWhenDataAvailableExceeds = s.NumberOfScans;
s

lh_6351 = s.addlistener('DataAvailable', @passData2);

% Configure trigger output on Dev6 (Trigger Source) & input on Dev8 (Trigger Target)
addTriggerConnection(d, 'Dev6/PFI12', 'External', 'StartTrigger');
addTriggerConnection(s, 'External', 'Dev8/PFI0', 'StartTrigger');

d.startbackground

s.startbackground

wait(d)

wait(s)

0 Kudos
Message 1 of 3
(248 Views)
Solution
Accepted by topic author LeeGwanWoo

You are not configuring any clock. Synchronization will not happen.

Try referring to Synchronize NI PCI Devices Using RTSI - MATLAB & Simulink

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 2 of 3
(222 Views)

Thank you for your answer!!

0 Kudos
Message 3 of 3
(214 Views)