05-12-2012 07:13 PM
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
05-12-2012 07:18 PM
How do you have your task setup? Is it a finite number of samples or continuous acquisition? Post your code.
05-12-2012 07:28 PM
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.
Thanks,
Eric
05-12-2012 07:32 PM
Always read ALL available measurements, not just one.
Use only the last one .
Blog for (mostly LabVIEW) programmers: Tips And Tricks