DAQmxReadRaw

NI-DAQmx C Functions

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). 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 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 bytes 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.