06-04-2024 02:46 AM - edited 06-04-2024 03:04 AM
Hello everybody
I developed a code to be able to stop the acquisition in finished mode with a stop button and it works quite well but I noticed a small loss of data
Why do you think there was this loss? and is there a way to fix this problem?
thanks in advance
06-04-2024 02:50 AM - edited 06-04-2024 02:53 AM
here is what I did on labview
06-04-2024 03:02 AM - edited 06-04-2024 03:02 AM
Hi Amelie,
@ameletudiante99 wrote:
I noticed a small loss of data
Please define "small loss of data"!
@ameletudiante99 wrote:
Why do you think there was this loss? and is there a way to fix this problem?
I guess you compare the number of samples read vs. the number of samples configured in your "Finite Samples" task!?
So you stop acquisition before the task has finished and still wonder why you read less samples than configured!?
06-04-2024 03:08 AM
2 acquisition channels at 25 kHz for 1 s I only read 24833 samples
yes I compare that but I have a loss even when I don't stop with the stop button
06-04-2024 03:21 AM - edited 06-04-2024 03:23 AM
Hi Amelie,
@ameletudiante99 wrote:
2 acquisition channels at 25 kHz for 1 s I only read 24833 samples
yes I compare that but I have a loss even when I don't stop with the stop button
So you miss 67 samples?
The problem is: between step 1 and 3 will be a (small) delay!
When you read the number of available samples (at step 1) the task is not finished yet, but milliseconds later (at step 3) it has finished. Your "loss" relates to this delay (67 samples / 25kS/s = 2.7ms)…
You may iterate the loop one more time or you may read the remaining samples from the buffer after the loop…
06-04-2024 04:03 AM
How can I iterate the while loop in my case?
can you put me on a trail?
I tried to put the while loop in a for loop I set the number of iterations as 2, the problem is solved but now if I want to stop I have to press the stop button twice
06-04-2024 04:52 AM
Hi Amelie,
@ameletudiante99 wrote:
How can I iterate the while loop in my case?
can you put me on a trail?
You want to stop the while loop when
06-04-2024 05:34 AM
@ameletudiante99 wrote:
here is what I did on labview
Try to call the DAQmx nodes in a different order.
In the while loop, first call "DAQmx Is Task Done?", then query "Available Samples Per Channel" and then DAQmx Read.
06-04-2024 05:38 AM
@UliB wrote:
@ameletudiante99 wrote:
here is what I did on labview
Try to call the DAQmx nodes in a different order.
In the while loop, first call "DAQmx Is Task Done?", then query "Available Samples Per Channel" and then DAQmx Read.
Or easier, just tell the Read to read the buffer size of samples and the loop is unencessary.
06-04-2024 05:47 AM
@Yamaeda wrote:
@UliB wrote:
@ameletudiante99 wrote:
here is what I did on labview
Try to call the DAQmx nodes in a different order.
In the while loop, first call "DAQmx Is Task Done?", then query "Available Samples Per Channel" and then DAQmx Read.
Or easier, just tell the Read to read the buffer size of samples and the loop is unencessary.
Well, OP didn't say it in this thread, but wanted to stop the read operation even if not all samples are taken in this thread https://forums.ni.com/t5/LabVIEW/stop-acquisition-in-finished-mode/m-p/4376436#M1286823 only yesterday 😎.