Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I flush a read buffer to avoid buffer overflow?

I'm running a continuous DAQ timed-loop near the limits of my computer.  (10k samples at 2.5MHz on a PCI-6115 with a hardware timed loop.)  Most of the time it runs ok, but occasionally windows goes out for a while and the DAQmx Read loop gets behind.  Over time the buffer gets full and eventually I'll get a -200279 error "Attempted to read samples that are no longer available.."  I can throttle things down and avoid this error, but I'd really like to do things differently.  If the loop gets behind I'd like to just drop unread data and pick up with the most recent data block.  Is there a way to do this?  Ideally, I was thinking for example about the following approaches:

 

1) Fixing the buffer size at the size of one of my read blocks and overwriting the buffer with each acquisition.  Is this possible?

 

2) Detecting if the buffer is getting full and flushing old data.  Is this possible?

 

Any other/better thoughts? I've experimented with the read property "Overwrite mode" but this hasn't worked for me.

 

Thanks and happy holidays!

0 Kudos
Message 1 of 4
(3,182 Views)

Hi CraigP

 

I hope this link will help you :

 

http://digital.ni.com/public.nsf/allkb/AB7D4CA85967804586257380006F0E62?OpenDocument

 

Best Regards,

 

 

 

 

0 Kudos
Message 2 of 4
(3,166 Views)

Merci Vincent. I have read this KB previously.  I ended up solving my problem by fixing the buffer size, setting it to overwrite and then ignoring the generated error.  Sometimes the buffer gets overwritten and I lose some data, but my loop keeps running fast, which was what I wanted. Merci pour votre aide. Bonne année et bonne santé!

0 Kudos
Message 3 of 4
(3,145 Views)

Thank you CraigP,

Have an happy new year

Bonne année !

0 Kudos
Message 4 of 4
(3,134 Views)