Use clocks to synchronize operations on all connected devices in the DataAcquisition. You connect a clock source to a clock destination. A clock source can be either external, where the clock signal comes from a source outside a DataAcquisition, or on a device and terminal pair within a DataAcquisition. Destination devices can be external, where the signals are received outside the DataAcquisition, or devices within the DataAcquisition. For more information, see Source and Destination Devices.
You cannot use trigger and clock connections with audio channels.
To import a scan clock from an external source, you must connect the external clock to a terminal and device pair on a device in your DataAcquisition. Two circumstances of externally clocked synchronization include:
Synchronizing operations on all devices within a DataAcquisition by sharing the clock on a device within the DataAcquisition or an external clock
Synchronizing operations on all devices within a DataAcquisition and some external devices, by sharing an external clock
Importing an external clock does not automatically set the scan rate of your
DataAcquisition. Manually set the DataAcquisition
Rate property value
to match the expected external clock frequency.
This example shows how to add a scan clock to a device and output the clock to a device outside your DataAcquisition, which is connected to an oscilloscope. The scan clock controls the operations on the external device.
Create a DataAcquisition and add a voltage input channel from an NI
USB-6211 with device ID
d = daq("ni"); addinput(d,"Dev1",0,"Voltage")
Add a clock to the DataAcquisition, to export an external scan clock
sourced at terminal
Dev1, and physically connect it to an external
c = addclock(d,"ScanClock","Dev1/PFI6","External")
c = Clock with properties: Source: 'Dev1/PFI6' Destination: 'External' Type: ScanClock
Acquire data and store it in
dataIn = read(d,seconds(1),"OutputFormat","Matrix");