NI DAQMX Read Functions - ni/grpc-device GitHub Wiki

Read Functions

DAQmxReadAnalogF64

int32 DAQmxReadAnalogF64 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, float64 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple floating-point samples from a task that contains one or more analog input channels.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray float64 [] The array to read samples into, organized according to fillMode.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadAnalogScalarF64

int32 DAQmxReadAnalogScalarF64 (TaskHandle taskHandle, float64 timeout, float64 *value, bool32 *reserved);

Purpose

Reads a single floating-point sample from a task that contains a single analog input channel.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read the sample from.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
value float64 * The sample read from the task.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadBinaryI16

int32 DAQmxReadBinaryI16 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, int16 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple unscaled, signed 16-bit integer samples from a task that contains one or more analog input channels.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray int16 [] The array to read samples into, organized according to fillMode.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadBinaryI32

int32 DAQmxReadBinaryI32 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, int32 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads one or more unscaled 32-bit signed integer samples from a task that contains one or more analog input channels.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task used in this function.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray int32 [] The array to read samples into, organized according to fillMode.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadBinaryU16

int32 DAQmxReadBinaryU16 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, uInt16 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple unscaled, unsigned 16-bit integer samples from a task that contains one or more analog input channels.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray uInt16 [] The array to read samples into, organized according to fillMode.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadBinaryU32

int32 DAQmxReadBinaryU32 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, uInt32 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads one or more unscaled 32-bit unsigned integer samples from a task that contains one or more analog input channels.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task used in this function.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray uInt32 [] The array to read samples into, organized according to fillMode.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCounterF64

int32 DAQmxReadCounterF64 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, float64 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple floating-point samples from a counter task. Use this function when counter samples are interleaved, and are scaled to a floating-point value, such as for frequency and period measurements.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray float64 [] The array to read samples into.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCounterF64Ex

int32 DAQmxReadCounterF64Ex (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, float64 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple floating-point samples from a counter task. Use this function when counter samples are scaled to a floating-point value, such as for frequency and period measurements.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray float64 [] The array to read samples into.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCounterScalarF64

int32 DAQmxReadCounterScalarF64 (TaskHandle taskHandle, float64 timeout, float64 *value, bool32 *reserved);

Purpose

Reads a single floating-point sample from a counter task. Use this function when the counter sample is scaled to a floating-point value, such as for frequency and period measurement.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read the sample from.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
value float64 * The sample read from the task.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCounterScalarU32

int32 DAQmxReadCounterScalarU32 (TaskHandle taskHandle, float64 timeout, uInt32 *value, bool32 *reserved);

Purpose

Reads a 32-bit integer sample from a counter task. Use this function when the counter sample is returned unscaled, such as for edge counting.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read the sample from.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
value uInt32 * The sample read from the task.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCounterU32

int32 DAQmxReadCounterU32 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, uInt32 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple 32-bit integer samples from a counter task. Use this function when counter samples are interleaved, and are returned unscaled, such as for edge counting.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray uInt32 [] The array to read samples into.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCounterU32Ex

int32 DAQmxReadCounterU32Ex (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, uInt32 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple 32-bit integer samples from a counter task. Use this function when counter samples are returned unscaled, such as for edge counting.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray uInt32 [] The array to read samples into.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCtrFreq

int32 DAQmxReadCtrFreq (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 interleaved, float64 readArrayFrequency[], float64 readArrayDutyCycle[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads one or more pairs of pulse frequency and duty cycle from a counter input task.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
interleaved bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArrayFrequency float64 [] The array to read frequency samples into.
readArrayDutyCycle float64 [] The array to read duty cycles into. The duty cycle is the pulse high time divided by the pulse period.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCtrFreqScalar

int32 DAQmxReadCtrFreqScalar (TaskHandle taskHandle, float64 timeout, float64 *frequency, float64 *dutyCycle, bool32 *reserved);

Purpose

Reads a single pair of pulse frequency and duty cycle from a counter input task.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read the sample from.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
frequency float64 * The pulse frequency.
dutyCycle float64 * The pulse high time divided by the pulse period.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCtrTicks

int32 DAQmxReadCtrTicks (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 interleaved, uInt32 readArrayHighTicks[], uInt32 readArrayLowTicks[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads one or more pairs of pulse high and low tick counts from a counter input task.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
interleaved bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArrayHighTicks uInt32 [] The array to read the number of high ticks into.
readArrayLowTicks uInt32 [] The array to read the number of low ticks into.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCtrTicksScalar

int32 DAQmxReadCtrTicksScalar (TaskHandle taskHandle, float64 timeout, uInt32 *highTicks, uInt32 *lowTicks, bool32 *reserved);

Purpose

Reads one or more pairs of pulse high and low tick counts from a counter input task.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read the sample from.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
highTicks uInt32 * The number of ticks the pulse is high.
lowTicks uInt32 * The number of ticks the pulse is low.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCtrTime

int32 DAQmxReadCtrTime (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 interleaved, float64 readArrayHighTime[], float64 readArrayLowTime[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads one or more pairs of pulse high and low times from a counter input task.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
interleaved bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArrayHighTime float64 [] The array to read the high time pulses into.
readArrayLowTime float64 [] The array to read the low time pulses into.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadCtrTimeScalar

int32 DAQmxReadCtrTimeScalar (TaskHandle taskHandle, float64 timeout, float64 *highTime, float64 *lowTime, bool32 *reserved);

Purpose

Reads one or more pairs of pulse high and low times from a counter input task.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read the sample from.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
highTime float64 * The amount of time the pulse is high.
lowTime float64 * The amount of time the pulse is low.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadDigitalLines

int32 DAQmxReadDigitalLines (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, uInt8 readArray[], uInt32 arraySizeInBytes, int32 *sampsPerChanRead, int32 *numBytesPerSamp, bool32 *reserved);

Purpose

Reads multiple samples from each digital line in a task. Each line in a channel gets one byte per sample.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Data property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInBytes uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray uInt8 [] The array to read samples into. Each numBytesPerSamp corresponds to one sample per channel, with each element in that grouping corresponding to a line in that channel, up to the number of lines contained in the channel.
sampsPerChanRead int32 * The actual number of samples read from each channel.
numBytesPerSamp int32 * The number of elements in readArray that constitutes a sample per channel. For each sample per channel, numBytesPerSamp is the number of bytes that channel consists of.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadDigitalScalarU32

int32 DAQmxReadDigitalScalarU32 (TaskHandle taskHandle, float64 timeout, uInt32 *value, bool32 *reserved);

Purpose

Reads a single 32-bit integer sample from a task that contains a single digital input channel. Use this function for devices with up to 32 lines per port. The sample is returned in unsigned integer format.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read the sample from.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample. The default value is 10.0 seconds. To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested sample. If the entire requested sample is read, the function is successful. Otherwise, the function returns a timeout error and returns what was actually read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
value uInt32 * The sample read from the task.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadDigitalU8

int32 DAQmxReadDigitalU8 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, uInt8 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple 8-bit integer samples from a task that has one or more multiple digital input channels. Use this function for devices with up to 8 lines per port. The samples are returned in unsigned byte format.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to write samples to.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray uInt8 [] The array to read samples into, organized according to fillMode.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadDigitalU16

int32 DAQmxReadDigitalU16 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, uInt16 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple 16-bit integer samples from a task that contains one or more digital input channels. Use this function for devices with up to 16 lines per port. The samples are returned in unsigned integer format.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray uInt16 [] The array to read samples into, organized according to fillMode.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

DAQmxReadDigitalU32

int32 DAQmxReadDigitalU32 (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, bool32 fillMode, uInt32 readArray[], uInt32 arraySizeInSamps, int32 *sampsPerChanRead, bool32 *reserved);

Purpose

Reads multiple 32-bit integer samples from a task that contains one or more digital input channels. Use this function for devices with up to 32 lines per port. The samples are returned in unsigned integer format.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. The default value of -1 (DAQmx_Val_Auto) reads all available samples. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Samples property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
fillMode bool32 Specifies whether or not the samples are interleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (non-interleaved)
DAQmx_Val_GroupByScanNumber Group by scan number (interleaved)
arraySizeInSamps uInt32 The size of the array, in samples, into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray uInt32 [] The array to read samples into, organized according to fillMode.
sampsPerChanRead int32 * The actual number of samples read from each channel.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.

Advanced

DAQmxGetNthTaskReadChannel

int32 DAQmxGetNthTaskReadChannel (TaskHandle taskHandle, uInt32 index, char buffer[], int32 bufferSize);

Purpose

Returns the Nth channel of the channels that are configured to be read by the DAQmxSetReadChannelsToRead property. This function takes the taskHandle, index, and bufferSize you specify and returns the Nth channel.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task used in this function.
index uInt32 The Nth channel to return. The index starts at 1.
bufferSize int32 The size, in bytes, of buffer. If you pass 0, this function returns the number of bytes needed to allocate.
Output
buffer char [] The Nth channel in the index. If you pass NULL, this function returns the number of bytes needed to allocate.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A negative value indicates an error.
For this function, if you pass NULL for the buffer or 0 for the buffer size, this function returns the number of bytes needed to allocate.

DAQmxReadRaw

int32 DAQmxReadRaw (TaskHandle taskHandle, int32 numSampsPerChan, float64 timeout, void *readArray, uInt32 arraySizeInBytes, int32 *sampsRead, int32 *numBytesPerSamp, bool32 *reserved);

Purpose

Reads raw samples directly from the input lines. There is no scaling, parsing, or separation of the samples. Refer to the specifications for your device to determine the format of the incoming samples.

Parameters

Input
Name Type Description
taskHandle TaskHandle The task to read samples from.
numSampsPerChan int32 The number of samples, per channel, to read. If you set this parameter to -1 (DAQmx_Val_Auto), NI-DAQmx determines how many samples to read based on whether the task acquires samples continuously or acquires a finite number of samples.
If the task acquires samples continuously and you set this parameter to -1, this function reads all the samples currently available in the buffer. If readArray does not contain enough space, this function returns as many samples as fit in readArray.
If the task acquires a finite number of samples and you set this parameter to -1, the function waits for the task to acquire all requested samples, then reads those samples. If you set the Read All Available Data property to TRUE, the function reads the samples currently available in the buffer and does not wait for the task to acquire all requested samples.
timeout float64 The amount of time, in seconds, to wait for the function to read the sample(s). To specify an infinite wait, pass -1 (DAQmx_Val_WaitInfinitely). This function returns an error if the timeout elapses.
A value of 0 indicates to try once to read the requested samples. If all the requested samples are read, the function is successful. Otherwise, the function returns a timeout error and returns the samples that were actually read.
arraySizeInBytes uInt32 The size of the array into which samples are read.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Output
Name Type Description
readArray void * The array into which samples are read.
sampsRead int32 * The actual number of samples read into the array per scan.
numBytesPerSamp int32 * The number of elements in readArray that constitutes a sample. This value takes into account all channels that are read. For example, five channels giving 12 bytes for one entire scan return 12 bytes. The value is not divided along channel lines.

Return Value

Name Type Description
status int32 The error code returned by the function in the event of an error or warning. A value of 0 indicates success. A positive value indicates a warning. A negative value indicates an error.
⚠️ **GitHub.com Fallback** ⚠️