Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Clearing already collected AI/Digital/Counter samples without stopping Tasks?

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

0 Kudos
Message 1 of 3
(2,562 Views)

Hi Lou_III

 

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.

 

Message Edited by david.bolt on 09-29-2009 09:56 AM
Many thanks for using the NI forums and I look forward to your reply.

Kind regards

David

Applications Engineer
National Instruments UK
0 Kudos
Message 2 of 3
(2,545 Views)

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.

Seth B.
Principal Test Engineer | National Instruments
Certified LabVIEW Architect
Certified TestStand Architect
0 Kudos
Message 3 of 3
(2,479 Views)