Synchronize with PFI on CompactDAQ Chassis Without Terminals

This example shows how to use the external trigger and external clock functionality on a CompactDAQ chassis without PFI terminals, by using the PFI terminals on digital I/O CompactDAQ modules.

Some CompactDAQ chassis (e.g., NI 9174 and 9172) do not support built-in triggers, because they do not have external BNC PFI connectors on the chassis itself. However, the PFI pins for these chassis can be accessed through a digital module such as the NI 9402.

%% Setup
% cDAQ 9174
% cDAQ2Mod3 is 9402
% cDAQ2Mod4 is 9201

%% For the start trigger
s = daq.createSession('ni');
addAnalogInputChannel(s,'cDAQ2Mod4','ai0','Voltage');
addTriggerConnection(s,'External','cDAQ2Mod3/PFI0','StartTrigger');
[data,timestamps] = startForeground(s);
plot(timestamps,data);

%% For the external scan clock
% Function generator provides 100 kHz clock to PFI1 terminal on NI 9402
s = daq.createSession('ni');
addDigitalChannel(s,'cDAQ2Mod3','Port0/Line2','InputOnly');
addClockConnection(s,'External','cDAQ2Mod3/PFI1','ScanClock');
s.Rate = 100E+3;
[data,timestamps] = startForeground(s);
plot(timestamps,data);