Acquire Digital Data Using an External Clock via Chassis PFI Terminal

The following example shows how to acquire clocked digital data using an external clock provided at the CompactDAQ chassis PFI terminal.

%% Setup
% cDAQ 9178 chassis
% cDAQ2Mod3 is 9402
% Digital signal is connected to PFI0 terminal of NI 9402 module
% Function generator provides 100 kHz clock to PFI0 terminal on NI 9178
% chassis

s = daq.createSession('ni');
addDigitalChannel(s, 'cDAQ2Mod3', 'Port0/Line0', 'InputOnly');
addClockConnection(s, 'External', 'cDAQ2/PFI0', 'ScanClock');
s.Rate = 100E+3;
[data, timestamps] = startForeground(s);
plot(timestamps, data);