Main Content

addClockConnection

(Not recommended) Add clock connection

This session object function is not recommended. Use DataAcquisition object functions instead. See Compatibility Considerations.

Description

example

addClockConnection(s,source,destination,type) adds a clock connection from the specified source device and terminal to the specified destination device and terminal, of the specified connection type.

Tip

Before adding clock connections, create a session using daq.createSession, and add channels to the session.

example

cc = addClockConnection(s,source,destination,type) adds a clock connection from the specified source device and terminal to the specified destination device and terminal, of the specified connection type and displays it in the variable cc.

example

[cc,idx] = addClockConnection(s,source,destination,type) adds a clock connection from the specified source device and terminal to the specified destination device and terminal, of the specified connection type and displays the connection in the variable cc and the connection index, idx.

Examples

collapse all

Create a session and add an analog input channel from Dev1 to the session.

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

Add a clock connection from an external device to terminal PFI1 on Dev1 using the 'ScanClock' connection type and save the connection settings to a variable.

cc = addClockConnection(s,'external','Dev1/PFI1','ScanClock');

To add a clock connection going to an external destination, create a session and add an analog input channel from Dev1 to the session.

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

Add a clock from terminal PFI0 on Dev1 to an external device using the 'ScanClock' connection type.

addClockConnection(s,'Dev1/PFI1','external','ScanClock');

Input Arguments

collapse all

Data acquisition session, specified as a session object. Create the session object using daq.createSession. Use the data acquisition session for acquisition and generation operations. Create one session per vendor and use that vendor session to perform all data acquisition operations.

Source for the clock connection, specified as a character vector or string. Valid values are:

  • 'external' — When your clock is based on an external event.

  • 'deviceID/terminal' — When your clock source is on a specific terminal on a device in your session, for example, 'Dev1/PFI1'. For more information on device ID see Device. For more information on terminal see step 4.

  • 'chassisId/terminal' — When your clock source is on a specific terminal on a chassis in your session, for example, 'cDAQ1/PFI1'. For more information on terminal see step 4.

You can have only one clock source in a session.

Data Types: char | string

Destination for the clock connection, specified as a character vector or string. Valid values are:

  • 'external' — When your clock source is connected to an external device.

  • 'deviceID/terminal' — When your clock source is connected to another device in your session, for example, 'Dev1/PFI1'. For more information on device ID see Device. For more information on terminal see step 4.

  • 'chassisId/terminal' — When your clock source is connected to a chassis in your session, for example, 'cDAQ1/PFI1'. For more information on terminal see step 4.

You can also specify multiple destination devices as an array, for example, {'Dev1/PFI1','Dev2/PFI1'}.

Data Types: char | string | cell

The clock connection type, specified as a character vector or string. 'ScanClock' is the only connection type available for clock connections at this time.

Data Types: char | string

Output Arguments

collapse all

The added clock connection, returned as a ScanClockConnection object containing clock connection information.

Channel index returned as a numeric value. Through the index you can access the array of the session object Channels property.

Version History

Introduced in R2012a

collapse all

R2020a: session object interface is not recommended

Use of this function with a session object is not recommended. To access a data acquisition device, use a DataAcquisition object with its functions and properties instead.

For more information about using the recommended functionality, see Transition Your Code from Session to DataAcquisition Interface.