LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to always read fresh data from cDAQ, ie. clear the buffer each run?

Hey,

     I have a basic cDAQ setup functioning in LabView and I'm trying to fix a technical issue. The program runs fine, but I've realized that running a loop that only reads a single value at a time, I may end up reading stale values if the buffer ever includes more than a single reading. I have both the loop and the cDAQ set at the same frequency, but I wonder if my loop hickups and takes slightly longer on an iteration, am I indefinitely one, two, or three samples behind in my readings. The problem may never be large enough to fill the buffer and throw an error, but I could surely get behind slightly.

     So my question is how could I always read the most recent values, instead of the next one in line? I'd also like to clear the buffer in a way because I'd like the code to theorhetically run forever without throwing a buffer overflow at the worst possible time. Is this possible? Should I just read more than one at a time, and only use the first (not ideal)? What do you think?

 

Thanks,

Eric

0 Kudos
Message 1 of 4
(2,341 Views)

How do you have your task setup?  Is it a finite number of samples or continuous acquisition?  Post your code.

0 Kudos
Message 2 of 4
(2,338 Views)

Hey, it's set up for continuous acquisition. It's a bit long, so I've seperated the relevant stuff as the first two images, and included the entire VI below. 

 

http://imgur.com/a/a3Ljk

 

Thanks,

Eric

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

Always read ALL available measurements, not just one.

Use only the last one .

Steve Bird
Culverson Software - Elegant software that is a pleasure to use.
Culverson.com


LinkedIn

Blog for (mostly LabVIEW) programmers: Tips And Tricks

0 Kudos
Message 4 of 4
(2,333 Views)