|On this page…|
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.
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
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 'Dev1'.
s = daq.createSession('ni'); s.addAnalogInputChannel('Dev1', 0, 'Voltage');
Step 2. Add a Clock Connection
Add an external clock to terminal 'PFI6' on 'Dev1' and 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.
dataIn = s.startForeground();