0

I am using LabVIEW with DAQmx to read data, and I need to read the chart every 100ms. I have the number of samples and the sampling rate, and I am using continuous acquisition mode.

To read every 100ms, I need to adjust the number of samples per channel in the Read function. However, I am unsure of how to do this consistently since the sampling rate can change.

What is the best way to ensure that I can read the chart every 100ms regardless of the changing sampling rate?

Thank for your help.

Images:

enter image description here

enter image description here

enter image description here

Hrathen23
  • 37
  • 5

1 Answers1

3

The answer is in your attached screenshot, but it's easy to miss! "If the task acquires samples continuously and you set this input to -1, this VI reads all the samples currently available in the buffer."

In order to refresh your chart every 100ms, you need to set number of samples per channel to -1 and put this VI in a loop so that it executes every 100ms.

There is one caveat to this: You need to be sure that your sample rate is low enough that the buffer on the device can't fill up in 100ms. If you can't ensure that you may need to separate reading from your device and updating your display into two parallel loops running at different rates. (You may have already seen this: https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P7KdSAK&l=en-US)

As a heads up, LabVIEW has a much more active community on the NI forums. If you have more LabVIEW or DAQmx questions you will get more visibility there!