Clock Connections

When to Use Clocks

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.


You cannot use trigger and clock connections with audio channels.

Import Scan Clock from External Source

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


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.

Export Scan Clock to External System

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.

Create a session and add one voltage input channel from NI USB-6211 with device ID 'Dev1'.

s = daq.createSession('ni');
addAnalogInputChannel(s,'Dev1', 0, 'Voltage');

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

Acquire data and store it in dataIn.

dataIn = startForeground(s); 

Related Examples

More About