Main Content

Synchronize with PFI on CompactDAQ Chassis Without Terminals

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

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.

Add a start trigger from an external source.

d = daq("ni");
addinput(d,"cDAQ2Mod4","ai0","Voltage")
addtrigger(d,"Digital","StartTrigger","External","cDAQ2Mod3/PFI0")
[data,timestamps] = read(d,seconds(1),"OutputFormat","Matrix");
plot(timestamps,data)

Use an external scan clock from a function generator providing a 100 kHz clock to terminal PFI1 on NI 9402.

d = daq("ni");
addinput(d,"cDAQ2Mod3","Port0/Line2","Digital")
addclock(d,"ScanClock","External","cDAQ2Mod3/PFI1")
d.Rate = 100E+3;
[data,timestamps] = read(d,seconds(1),"OutputFormat","Matrix");
plot(timestamps,data);

Tip

If you want your devices to run at multiple scan rates, use two separate DataAcquisition objects with different scan rate settings.

Related Topics