LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sample Rate for reading out data

hello,

i am new to labview and would appreciate help with a sampling rate issue. 

I am using two different daqs to obtain data. in the program, i need to read data out at a rate of 1 sample a second, and then the data is written to a file every minute. right now, no matter how i set the sample clock, it reads at slightly slower than one sample a second, and it gets progressively slower and slower as the program runs. Is there a way to time the read vi to read data once a second? or is this an issue with needing to synchronize the two different daqs i am using onto the same clock?

attached is the program

 

thanks!

0 Kudos
Message 1 of 3
(2,163 Views)

Hi,

   One sample per second is pretty low, so you have lots of options. You could replace the inner "for" loop which executes 60 times with a "timed while loop" with a period of one second. If the loop is already slower than one second, something inside may be taking too long. In general, with DAQmx, best practice is to setup the task outside the loop and only call read or write inside it. The multiple places you setup a task inside the loop may be reducing the overall loop rate below 1 hz. In your case, I think you can setup all your tasks, including AI/AO, Sample Clock, Start at the beginning and move Stop and Clear to the end when the whole program is ending.

 

Good luck!

0 Kudos
Message 2 of 3
(2,149 Views)
Unless your device supports hardware timed single input and unless you configure it for that mode, the sample clock setting its irrelevant. You are in software timed mode.
0 Kudos
Message 3 of 3
(2,136 Views)