Multiple-Chassis Synchronization with CompactDAQ Devices
This example shows how to acquire voltage data from two devices, each on a
separate CompactDAQ chassis, using a shared trigger and clock to synchronize operations within
your DataAcquisition object.
You can synchronize multiple CompactDAQ chassis with a DataAcquisition
object by using one chassis to provide clocking and triggering for all the other chassis in the
DataAcquisition object. Clock and trigger sources are attached to terminals on
the chassis, itself. All modules on the chassis as well as other connected devices, are
synchronized using these signals.
Create a DataAcquisition object
and add channels. Add one voltage input channel each from the two NI 9201 devices with IDs
cDAQ1Mod1 and cDAQ2Mod1.
d = daq("ni"); addinput(d,"cDAQ1Mod1",0,"Voltage") addinput(d,"cDAQ2Mod1",0,"Voltage")
Choose terminal PFI0 on cDAQ1 as your trigger
source, and connect it to destination terminal PFI0 on
cDAQ2. Make sure the wiring on the hardware runs between these two
terminals. Note that you are using the chassis and terminal pair here, not device and terminal
pair.
addtrigger(d,"Digital","StartTrigger","cDAQ1/PFI0","cDAQ2/PFI0")
Choose terminal PFI1 on cDAQ1 as your clock source,
and connect it to destination terminal PFI1 on cDAQ2.
Make sure the wiring on the hardware runs between these terminals.
addclock(d,"ScanClock","cDAQ1/PFI1","cDAQ2/PFI1")
Acquire data and assign it to dataIn.
dataIn = read(d,seconds(1),"OutputFormat","Matrix");