Main Content

Acquire Digital Data Using an External Clock via Chassis PFI Terminal

This example shows how to acquire clocked digital data using an external clock provided at the CompactDAQ chassis PFI terminal. It uses a cDAQ 9178 chassis and NI 9402 module with ID cDAQ2Mod3. A digital signal is connected to the module PFI0 terminal to provide a scan clock.

Create a DataAcquisition object and add the digital input line.

d = daq("ni");

Add a clock specifying source and destination. Then set the DataAcquisition scan rate to match the external clock frequency.

d.Rate = 100e3;

Acquire and plot the digital input data.

[data,timestamps] = read(d,seconds(1),"OutputFormat","Matrix");