Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx read problem

Hi,
 
I'm using a NI USB-6218 to perform some data aquisitions from a compressor, but i'm having some trouble with the running speed of my while loop.
I got a DAQmx read 1D DBL 1Chan NSamp inside the loop, and its Sampling Rate is set to 10k Hz with 1000 Samples per channel. After the DAQmx read i'm taking the average of the array, so that would give me 10 points per second, right ?
But it seems that my while loop is not synchronized with my sampling rate, so it keeps running really fast.
I also set the X Scale Multiplier to 'Samples per channel divided by Sampling Rate', which equals to 0.1, and should make my X scale to be synchronized with the real world time clock, but it is also not working.
What should i do ?
 
My code is attached below.
Thank you !
0 Kudos
Message 1 of 2
(2,951 Views)
If I'm understanding your application correctly, you would like to display the average of every 10 points acquired onto the waveform graph.

By default, the DAQmx Read VI will read as many samples as are available.  When called in a loop that runs very often such as in your application, this means that DAQmx Read will sometimes even return zero samples.

Try supplying a value of 10 for the "number of samples per channel" input to the DAQmx Read VI, and let us know if this does not make your application behave as you would like.
0 Kudos
Message 2 of 2
(2,907 Views)