I'm using DAQmxWriteAnalogF64() to write arrays of values to an analog output channel. It works fine the first time DAQmxWriteAnalogF64() called. The second call fails as follows:
Function DAQmxWriteAnalogF64: (return value == -200288)
Attempted to write a sample beyond the final sample generated. The
generation has stopped, therefore the sample specified by the
combination of position and offset will never be available.
Specify a position and offset which selects a sample up to, but not
beyond, the final sample generated. The final sample generated can be
determined by querying the total samples generated after a generation
has stopped.
Attempted to Write Sample: 101
Property: DAQmx_Write_RelativeTo
Corresponding Value: DAQmx_Val_CurrWritePos
Property: DAQmx_Write_Offset
Corresponding Value: 0
If I delete the task and create it again every time I call DAQmxWriteAnalogF64() everything works fine. But surely that's not the "right" way. Or is it?
The error message seems to indicate that subsequent calls to DAQmxWriteAnalogF64() add the new array of samples to the end of some output buffer. How do I tell it to start over at the beginning of the buffer each time DAQmxWriteAnalogF64() is called?
All I want DAQmxWriteAnalogF64() to do is transmit an array of samples I provide each time I call it. It works on the first call only.
How do I "specify a position and offset" as directed in the above text?
How do I "querying the total samples generated" as directed?
Is it possible to reset the task without deleting and recreating it each time I call DAQmxWriteAnalogF64()?
I found a function that appears to change an attribute of the task from "relative" to "offset" positioning of the buffer pointer. But the function doesn't provide enough parameters to do what it says it does. The function is DAQmxResetWriteAttribute(). It has an attribute called "Relative To". The help text says to specify a value for the attribute of either DAQmx_Val_FirstSample or DAQmx_Val_CurrWritePos, but there's no parameter available to do that.
Please help, I'm lost!