From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample rate of NI module

Hi!

 

I am using Labview to control a DAQ with one voltage module, NI 9229, and one temperature module, NI 9211, I switch with a NI 9485. But I can’t get the sampling rate correct for the voltage. Labview takes a different amount of samples for every cycle. Sometimes the difference is huge, about half the samples, and sometimes the difference is just a few samples. See the attached figure. The temperature have the same amount of samples on every cycle.

 

I have tried with different sample rates but when I try with a low sample rate (100) one on/off cycle takes more than 10 seconds when it is suppose to take 2, this happens also if I choose a high sample rate. The best result I have got is when I use a sample rate of 10000, when I use a stopwatch then I get that one cycle is about one seconds which it should be but the number of samples is still different.

 

I have looked on the signal with an oscilloscope and it is correct with 1 second on and 1 second off, so I don’t think the problem is the signal itself.

 

What can be the problem, and how do I fix it?

Download All
0 Kudos
Message 1 of 3
(2,240 Views)

Reading 1 sample at a time and pushing it to a file will cause problems. You can e.g. read 1 sec worth of samples (easy done as you just wire the samplerate wire to # of samples read) and handle that, or send the file writing to a queued loop.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 3
(2,210 Views)

I would recommend using the TDMS Streaming for the DAQmx.  It will take care of all of the logging for you.  Look in the Example Finder (Help->Find Examples) and look for a DAQmx Analog Input example.  It should have the Configure Logging in it for you to see how to use it.

 

You should also be reading all of the available samples at a time.  For the DAQmx Read, use the multiple sample setup and wire in a -1 to the number of samples to read.  I'm thinking you are overrunning your DAQmx buffer and threfore losing data.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 3 of 3
(2,205 Views)