NI-DAQmx C Reference Help

Edition Date: January 2019

Part Number: 370471AM-01

»View Product Info
Download Help (Windows Only)

int32 DAQmxWriteBinaryI16 (TaskHandle taskHandle, int32 numSampsPerChan, bool32 autoStart, float64 timeout, bool32 dataLayout, int16 writeArray[], int32 *sampsPerChanWritten, bool32 *reserved);


Writes unscaled signed integer samples to the task.

Note If you configured timing for your task, your write is considered a buffered write. Buffered writes require a minimum buffer size of 2 samples. If you do not configure the buffer size using DAQmxCfgOutputBuffer, NI-DAQmx automatically configures the buffer when you configure sample timing. If you attempt to write one sample for a buffered write without configuring the buffer, you will receive an error.


Name Type Description
taskHandle TaskHandle The task to write samples to.
numSampsPerChan int32 The number of samples, per channel, to write. You must pass in a value of 0 or more in order for the sample to write. If you pass a negative number, this function returns an error.
autoStart bool32 Specifies whether or not this function automatically starts the task if you do not start it.
timeout float64 The amount of time, in seconds, to wait for this function to write all the samples. 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 write the submitted samples. If this function successfully writes all submitted samples, it does not return an error. Otherwise, the function returns a timeout error and returns the number of samples actually written.
dataLayout bool32 Specifies how the samples are arranged, either interleaved or noninterleaved.
Value Description
DAQmx_Val_GroupByChannel Group by channel (noninterleaved)
DAQmx_Val_GroupByScanNumber Group by sample (interleaved)
writeArray int16 [] The array of 16-bit samples to write to the task.
reserved bool32 * Reserved for future use. Pass NULL to this parameter.
Name Type Description
sampsPerChanWritten int32 * The actual number of samples per channel successfully written to the buffer.

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.


Not Helpful