Main Content

addclock

Add clock connection to device interface

Since R2020a

Description

addclock(d,"ScanClock",clkSrc,clkDest) adds a clock connection to the DataAcquisition interface for sharing, importing, or exporting a clock configuration. The created clock connection is appended to the Clocks property of the DataAcquisition object.

clk = addclock(___) adds the clock and returns the clock object.

[clk,idx] = addclock(___) adds the clock and returns the clock object and the clock index from the DataAcquisition interface.

example

Examples

collapse all

Add clocks to a DataAcquisition interface in various configurations.

Add a clock shared between two devices.

d = daq("ni");
addinput(d,"Dev1","ai0","Voltage")
addinput(d,"Dev2","ai0","Voltage")
addclock(d,"ScanClock","Dev1/PFI0","Dev2/PFI0")

Add a clock imported from an external source.

d = daq("ni");
addinput(d,"Dev1","ai0","Voltage")
addclock(d,"ScanClock","External","Dev1/PFI0")

Add a clock exported to external destination.

d = daq("ni");
addinput(d,"Dev1","ai0","Voltage")
addclock(d,"ScanClock","Dev1/PFI0","External")

Add a scan clock from an external source supplied at terminal PXI1Slot5/PXI_Star.

d = daq("ni");
addinput(d,"PXI1Slot5",0,"Voltage")
addclock(d,"ScanClock","External","PXI1Slot5/PXI_Star")

Input Arguments

collapse all

DataAcquisition interface, specified as a DataAcquisition object, created using the daq function.

Example: d = daq()

Clock signal source, specified as a string or character vector indicating a device terminal, or "external" when importing a clock from an external source.

Example: "external"

Data Types: char | string

Clock signal destination, specified as a string or character vector indicating a device terminal, or "external" when exporting a clock to an external destination.

Example: "external"

Data Types: char | string

Output Arguments

collapse all

Clock connection, returned as a Clock object with properties Source, Destination, and Type.

Clock index, returned as a numeric value. With this index, you can access the array of the DataAcquisition Clocks property.

Version History

Introduced in R2020a

See Also

Functions