Skip to content

NI DAQMX Read Attributes

Greg Stoll edited this page Sep 10, 2021 · 2 revisions

Read Attributes

See how to get and set attributes.

DAQmx_Read_RelativeTo

Data Type: int32
Description: Specifies the point in the buffer at which to begin a read operation. If you also specify an offset with DAQmx_Read_Offset, the read operation begins at that offset relative to the point you select with this property. The default value is DAQmx_Val_CurrReadPos unless you configure a Reference Trigger for the task. If you configure a Reference Trigger, the default value is DAQmx_Val_FirstPretrigSamp.

Valid values

DAQmx_Val_FirstSample 10424 Start reading samples relative to the first sample acquired.
DAQmx_Val_CurrReadPos 10425 Start reading samples relative to the last sample returned by the previous read. For the first read operation, this position is the first sample acquired or the first pretrigger sample if you configured a reference trigger for the task.
DAQmx_Val_RefTrig 10426 Start reading samples relative to the first sample after the reference trigger occurred.
DAQmx_Val_FirstPretrigSamp 10427 Start reading samples relative to the first pretrigger sample. You specify the number of pretrigger samples to acquire when you configure a reference trigger.
DAQmx_Val_MostRecentSamp 10428 Start reading samples relative to the next sample acquired. For example, use this value and set DAQmx_Read_Offset to -1 to read the last sample acquired.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Read_Offset

Data Type: int32
Description: Specifies an offset in samples per channel at which to begin a read operation. This offset is relative to the location you specify with DAQmx_Read_RelativeTo.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Read_ChannelsToRead

Data Type: char*
Description: Specifies a subset of channels in the task from which to read.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Read_ReadAllAvailSamp

Data Type: bool32
Description: Specifies whether subsequent read operations read all samples currently available in the buffer or wait for the buffer to become full before reading. NI-DAQmx uses this setting for finite acquisitions and only when the number of samples to read is -1. For continuous acquisitions when the number of samples to read is -1, a read operation always reads all samples currently available in the buffer.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Read_AutoStart

Data Type: bool32
Description: Specifies if an NI-DAQmx Read function automatically starts the task if you did not start the task explicitly by using DAQmxStartTask(). The default value is TRUE. When an NI-DAQmx Read function starts a finite acquisition task, it also stops the task after reading the last sample.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Read_OverWrite

Data Type: int32
Description: Specifies whether to overwrite samples in the buffer that you have not yet read.

Valid values

DAQmx_Val_OverwriteUnreadSamps 10252 When an acquisition encounters unread data in the buffer, the acquisition continues and overwrites the unread samples with new ones. You can read the new samples by setting DAQmx_Read_RelativeTo to DAQmx_Val_MostRecentSamp and setting DAQmx_Read_Offset to the appropriate number of samples.
DAQmx_Val_DoNotOverwriteUnreadSamps 10159 The acquisition stops when it encounters a sample in the buffer that you have not read.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

Logging

DAQmx_Logging_FilePath

Data Type: char*
Description: Specifies the path to the TDMS file to which you want to log data. If the file path is changed while the task is running, this takes effect on the next sample interval (if Logging.SampsPerFile has been set) or when DAQmx Start New File is called. New file paths can be specified by ending with "" or "/". Files created after specifying a new file path retain the same name and numbering sequence.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Logging_Mode

Data Type: int32
Description: Specifies whether to enable logging and whether to allow reading data while logging. Log mode allows for the best performance. However, you cannot read data while logging if you specify this mode. If you want to read data while logging, specify Log and Read mode.

Valid values

DAQmx_Val_Off 10231 Disable logging for the task.
DAQmx_Val_Log 15844 Enable logging for the task. You cannot read data using an NI-DAQmx Read function when using this mode. If you require access to the data, read from the TDMS file.
DAQmx_Val_LogAndRead 15842 Enable both logging and reading data for the task. You must use an NI-DAQmx Read function to read samples for NI-DAQmx to stream them to disk.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

Tdms

DAQmx_Logging_TDMS_GroupName

Data Type: char*
Description: Specifies the name of the group to create within the TDMS file for data from this task. If you append data to an existing file and the specified group already exists, NI-DAQmx appends a number symbol and a number to the group name, incrementing that number until finding a group name that does not exist. For example, if you specify a group name of Voltage Task, and that group already exists, NI-DAQmx assigns the group name Voltage Task #1, then Voltage Task #2.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Logging_TDMS_Operation

Data Type: int32
Description: Specifies how to open the TDMS file.

Valid values

DAQmx_Val_Open 10437 Open an existing TDMS file, and append data to that file. If the file does not exist, NI-DAQmx returns an error.
DAQmx_Val_OpenOrCreate 15846 Open an existing TDMS file, and append data to that file. If the file does not exist, NI-DAQmx creates a new TDMS file.
DAQmx_Val_CreateOrReplace 15847 Create a new TDMS file, or replace an existing TDMS file.
DAQmx_Val_Create 15848 Create a new TDMS file. If the file already exists, NI-DAQmx returns an error.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Logging_Pause

Data Type: bool32
Description: Specifies whether logging is paused while a task is executing. If DAQmx_Logging_Mode is set to Log and Read mode, this value is taken into consideration on the next call to DAQmx Read, where data is written to disk. If DAQmx_Logging_Mode is set to Log Only mode, this value is taken into consideration the next time that data is written to disk. A new TDMS group is written when logging is resumed from a paused state.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Logging_SampsPerFile

Data Type: uInt64
Description: Specifies how many samples to write to each file. When the file reaches the number of samples specified, a new file is created with the naming convention of _####.tdms, where #### starts at 0001 and increments automatically with each new file. For example, if the file specified is C:\data.tdms, the next file name used is C:\data_0001.tdms. To disable file spanning behavior, set this attribute to 0. If DAQmx_Logging_FilePath is changed while this attribute is set, the new file path takes effect on the next file created.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Logging_FileWriteSize

Data Type: uInt32
Description: Specifies the size, in samples, in which data will be written to disk. The size must be evenly divisible by the volume sector size, in bytes.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Logging_FilePreallocationSize

Data Type: uInt64
Description: Specifies a size in samples to be used to pre-allocate space on disk. Pre-allocation can improve file I/O performance, especially in situations where multiple files are being written to disk. For finite tasks, the default behavior is to pre-allocate the file based on the number of samples you configure the task to acquire.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

Status

DAQmx_Read_CurrReadPos

Data Type: uInt64
Description: Indicates in samples per channel the current position in the buffer.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_AvailSampPerChan

Data Type: uInt32
Description: Indicates the number of samples available to read per channel. This value is the same for all channels in the task.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_TotalSampPerChanAcquired

Data Type: uInt64
Description: Indicates the total number of samples acquired by each channel. NI-DAQmx returns a single value because this value is the same for all channels. For retriggered acquisitions, this value is the cumulative number of samples across all retriggered acquisitions.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Common Mode Range Error

DAQmx_Read_CommonModeRangeErrorChansExist

Data Type: bool32
Description: Indicates if the device(s) detected a common mode range violation for any virtual channel in the task. Common mode range violation occurs when the voltage of either the positive terminal or negative terminal to ground are out of range. Reading this property clears the common mode range violation status for all channels in the task. You must read this property before you read DAQmx_Read_CommonModeRangeErrorChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_CommonModeRangeErrorChans

Data Type: char*
Description: Indicates a list of names of any virtual channels in the task for which the device(s) detected a common mode range violation. You must read DAQmx_Read_CommonModeRangeErrorChansExist before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Excitation Fault

DAQmx_Read_ExcitFaultChansExist

Data Type: bool32
Description: Indicates if the device(s) detected an excitation fault condition for any virtual channel in the task. Reading this property clears the excitation fault status for all channels in the task. You must read this property before you read DAQmx_Read_ExcitFaultChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_ExcitFaultChans

Data Type: char*
Description: Indicates a list of names of any virtual channels in the task for which the device(s) detected an excitation fault condition. You must read DAQmx_Read_ExcitFaultChansExist before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Overcurrent

DAQmx_Read_OvercurrentChansExist

Data Type: bool32
Description: Indicates if the device(s) detected an overcurrent condition for any virtual channel in the task. Reading this property clears the overcurrent status for all channels in the task. You must read this property before you read DAQmx_Read_OvercurrentChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_OvercurrentChans

Data Type: char*
Description: Indicates a list of names of any virtual channels in the task for which the device(s) detected an overcurrent condition. You must read DAQmx_Read_OvercurrentChansExist before you read this property. Otherwise, you will receive an error. On some devices, you must restart the task for all overcurrent channels to recover.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Overtemperature

DAQmx_Read_OvertemperatureChansExist

Data Type: bool32
Description: Indicates if the device(s) detected an overtemperature condition in any virtual channel in the task. Reading this property clears the overtemperature status for all channels in the task. You must read this property before you read DAQmx_Read_OvertemperatureChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_OvertemperatureChans

Data Type: char*
Description: Indicates a list of names of any overtemperature virtual channels. You must read DAQmx_Read_OvertemperatureChansExist before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Open Channels

DAQmx_Read_OpenChansExist

Data Type: bool32
Description: Indicates if the device or devices detected an open channel condition in any virtual channel in the task. Reading this property clears the open channel status for all channels in this task. You must read this property before you read DAQmx_Read_OpenChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_OpenChans

Data Type: char*
Description: Indicates a list of names of any open virtual channels. You must read DAQmx_Read_OpenChansExist before you read this property. Otherwise you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_OpenChansDetails

Data Type: char*
Description: Indicates a list of details of any open virtual channels. You must read DAQmx_Read_OpenChansExist before you read this property. Otherwise you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Open Current Loop

DAQmx_Read_OpenCurrentLoopChansExist

Data Type: bool32
Description: Indicates if the device(s) detected an open current loop for any virtual channel in the task. Reading this property clears the open current loop status for all channels in the task. You must read this property before you read DAQmx_Read_OpenCurrentLoopChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_OpenCurrentLoopChans

Data Type: char*
Description: Indicates a list of names of any virtual channels in the task for which the device(s) detected an open current loop. You must read DAQmx_Read_OpenCurrentLoopChansExist before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Open Thermocouple

DAQmx_Read_OpenThrmcplChansExist

Data Type: bool32
Description: Indicates if the device(s) detected an open thermocouple connected to any virtual channel in the task. Reading this property clears the open thermocouple status for all channels in the task. You must read this property before you read DAQmx_Read_OpenThrmcplChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_OpenThrmcplChans

Data Type: char*
Description: Indicates a list of names of any virtual channels in the task for which the device(s) detected an open thermcouple. You must read DAQmx_Read_OpenThrmcplChansExist before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Overload

DAQmx_Read_OverloadedChansExist

Data Type: bool32
Description: Indicates if the device(s) detected an overload in any virtual channel in the task. Reading this property clears the overload status for all channels in the task. You must read this property before you read DAQmx_Read_OverloadedChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_OverloadedChans

Data Type: char*
Description: Indicates a list of names of any overloaded virtual channels in the task. You must read DAQmx_Read_OverloadedChansExist before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Input Limits Fault

DAQmx_Read_InputLimitsFaultChansExist

Data Type: bool32
Description: Indicates if the device or devices detected a sample that was outside the upper or lower limits configured for each channel in the task. Reading this property clears the input limits fault channel status for all channels in the task. You must read this property before you read DAQmx_Read_InputLimitsFaultChans. Otherwise, you will receive an error. Note: Fault detection applies to both positive and negative inputs. For instance, if you specify a lower limit of 2 mA and an upper limit of 12 mA, NI-DAQmx detects a fault at 15 mA and -15 mA, but not at -6 mA because it is in the range of -12 mA to -2 mA.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_InputLimitsFaultChans

Data Type: char*
Description: Indicates the virtual channels that have detected samples outside the upper or lower limits configured for each channel in the task. You must read DAQmx_Read_InputLimitsFaultChansExist before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Phase-Locked Loop

DAQmx_Read_PLL_UnlockedChansExist

Data Type: bool32
Description: Indicates whether the PLL is currently locked, or whether it became unlocked during the previous acquisition. Devices may report PLL Unlock either during acquisition or after acquisition.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_PLL_UnlockedChans

Data Type: char*
Description: Indicates the channels that had their PLLs unlock.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Power Supply Fault

DAQmx_Read_PowerSupplyFaultChansExist

Data Type: bool32
Description: Indicates if the device or devices detected a power supply fault condition in any virtual channel in the task. Reading this property clears the power supply fault status for all channels in this task. You must read this property before you read DAQmx_Read_PowerSupplyFaultChans. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_PowerSupplyFaultChans

Data Type: char*
Description: Indicates the virtual channels that have detected a power supply fault. You must read DAQmx_Write_PowerSupplyFaultChansExist before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Synchronization

DAQmx_Read_Sync_UnlockedChansExist

Data Type: bool32
Description: Indicates whether the target is currently locked to the grand master. Devices may report PLL Unlock either during acquisition or after acquisition.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_Sync_UnlockedChans

Data Type: char*
Description: Indicates the channels from devices in an unlocked target.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Accessory

DAQmx_Read_AccessoryInsertionOrRemovalDetected

Data Type: bool32
Description: Indicates if any device(s) in the task detected the insertion or removal of an accessory since the task started. Reading this property clears the accessory change status for all channels in the task. You must read this property before you read DAQmx_Read_DevsWithInsertedOrRemovedAccessories. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_DevsWithInsertedOrRemovedAccessories

Data Type: char*
Description: Indicates the names of any devices that detected the insertion or removal of an accessory since the task started. You must read DAQmx_Read_AccessoryInsertionOrRemovalDetected before you read this property. Otherwise, you will receive an error.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Status Advanced

Changedetection

DAQmx_Read_ChangeDetect_HasOverflowed

Data Type: bool32
Description: Indicates if samples were missed because change detection events occurred faster than the device could handle them. Some devices detect overflows differently than others.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Advanced

DAQmx_Read_RawDataWidth

Data Type: uInt32
Description: Indicates in bytes the size of a raw sample from the task.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_NumChans

Data Type: uInt32
Description: Indicates the number of channels that an NI-DAQmx Read function reads from the task. This value is the number of channels in the task or the number of channels you specify with DAQmx_Read_ChannelsToRead.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

Digital Input

DAQmx_Read_DigitalLines_BytesPerChan

Data Type: uInt32
Description: Indicates the number of bytes per channel that NI-DAQmx returns in a sample for line-based reads. If a channel has fewer lines than this number, the extra bytes are FALSE.
Restrictions: Not Settable

You can get this attribute using:   DAQmxGetReadAttribute

DAQmx_Read_WaitMode

Data Type: int32
Description: Specifies how an NI-DAQmx Read function waits for samples to become available.

Valid values

DAQmx_Val_WaitForInterrupt 12523 Check for available samples when the system receives an interrupt service request. This mode is the most CPU efficient, but results in lower possible sampling rates.
DAQmx_Val_Poll 12524 Repeatedly check for available samples as fast as possible. This mode allows for the highest sampling rates at the expense of CPU efficiency.
DAQmx_Val_Yield 12525 Repeatedly check for available samples, but yield control to other threads after each check. This mode offers a balance between sampling rate and CPU efficiency.
DAQmx_Val_Sleep 12547 Check for available samples once per the amount of time specified in DAQmx_Read_SleepTime.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

DAQmx_Read_SleepTime

Data Type: float64
Description: Specifies in seconds the amount of time to sleep after checking for available samples if DAQmx_Read_WaitMode is DAQmx_Val_Sleep.

You can get/set/reset this attribute using:   DAQmxGetReadAttribute   DAQmxSetReadAttribute   DAQmxResetReadAttribute

Table of Contents

Internal Development

Creating and Setting Up a gRPC Server

Server Security Support

Creating a gRPC Client

gRPC Client Examples

Session Utilities API Reference

Driver Documentation

gRPC API Differences From C API

Sharing Driver Sessions Between Clients

C API Docs
NI-DAQmx
NI-DCPOWER
NI-DIGITAL PATTERN DRIVER
NI-DMM
NI-FGEN
NI-FPGA
NI-RFmx Bluetooth
NI-RFmx NR
NI-RFmx WCDMA
NI-RFmx GSM
NI-RFmx CDMA2k
NI-RFmx Instr
NI-RFmx LTE
NI-RFmx SpecAn
NI-RFmx TD-SCDMA
NI-RFmx WLAN
NI-RFSA
NI-RFSG
NI-SCOPE
NI-SWITCH
NI-TCLK
NI-XNET
Clone this wiki locally