09-28-2009 11:25 AM
Simple question, Is there any way to clear the data that has already been collected into AI/Digital/Counter tasks that have already been started ? I want to be able to clear the data without consuming the time to read off the data as it is just being thrown away. So is there something other than using DAQmxGetReadAvailSampPerChan and then reading off that data into arrays and throwing it away? I've searched the forums and looked at the help but can't find a "DAQmxClearBuffer" function. FYI: Stopping the tasks is not an option due to encoder limitations within the NI DAQ API (it always resets the current counter value.)
Thanks in advance for any help
09-29-2009 09:53 AM - edited 09-29-2009 09:56 AM
Thanks for your post. I think I understand your problem which can be solved very easily using a DAQmx Clear Task VI at the start of your program to clear the buffer of any data and avoids allocating unneccessary memory. Please send me your code if this is different to what you are wanting.
09-29-2009 10:08 AM
I would recommend that you use the "DAQmxSetReadRelativeTo" and "DAQmxSetReadOffset" to set your read position to the later samples that you actually want, and ignore the warning that is generated if samples are overwritten. If you have problems with this, you may also need to set "DAQmxSetReadOverWrite" to "DAQmx_Val_OverwriteUnreadSamps" to insure that you continue acquiring samples once samples start being overwritten.