Use clocks to synchronize operations on all connected devices in the session. 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 session, or on a device and terminal pair within a session. Destination devices can be external, where the signals are received outside the session, or devices within the session. To understand source and destination devices, see Source and Destination Devices.
Note: 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 session. Two circumstances of externally clocked synchronization include:
Synchronizing operations on all devices within a session by sharing the clock on a device within the session or an external clock
Synchronizing operations on all devices within a session and some external devices, by sharing an external clock
Note: Importing an external clock does not automatically set the rate of your session. Manually set the session's rate 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 session, which is connected to an oscilloscope. The scan clock controls the operations on the external device.
Step 1. Create a data acquisition session and add channels.
Create a session and add one voltage input channel from NI USB-6211
with device ID
s = daq.createSession('ni'); addAnalogInputChannel(s,'Dev1', 0, 'Voltage');
Step 2. Add a Clock Connection
Add an external clock to terminal
connect it to an external destination.
ans = Scan Clock for 'Dev1' will available at terminal 'PFI6' for external use. Source: 'Dev1/PFI6' Destination: 'External' Type: ScanClock
Step 3. Acquire data.
Acquire data and store it in
dataIn = startForeground(s);