Showing results for 
Search instead for 
Did you mean: 

Independent Sample and log rates

If you've set the express VI for a value of .5, then it will in fact call the write file every .5 seconds. If you want to write a single value every .5 seconds, then you need to say that.
0 Kudos
Message 11 of 18

Ahhh right.  What I asked for was not what I was trying to accomplish.  Strugging with timing concepts.


I want to write a single value every 0.5 seconds. 



0 Kudos
Message 12 of 18
Then I would suggest that you take the mean of the samples. The same for that silly convert from dynamic data. What that is doing is discarding 99 of the 100 samples you've taken. Doesn't seem to be any point to have continuous acquisition and then throw away most of the data.

Note that with continuous acquisition, you have to keep up with it to avoid buffer overflow. The Write to Measurement File is slow and you might see the error.
0 Kudos
Message 13 of 18

Ok...I am lost at the moment.  But will work on it.


Can you send me some modified code and I will try to reverse engineer that.


Also if there is a prefered method using low level code I would like to see that.



0 Kudos
Message 14 of 18

Is this what you recommended ? 


Suggestion for improving accuracy of 0.5 second intervals ?



0 Kudos
Message 15 of 18

Hi ggress1,


Based on the .png you posted, it does look like your code will take the average of 50 samples every time the while loop iterates. 


The true test will be when you run your code, do you receive what you desire?


Kevin S
Applications Engineer
National Instruments
0 Kudos
Message 16 of 18

The mod2 code does work (thanks dennis k) but I still need to understand why Mod1 version attached does not. 


My assumption about daqmx read command it probably wrong but help me to understand. 


1) I assume the read (1chan 1samp) daqmx command should execute and aquire one sample at every loop iteration yes/no ?


2) How would I acquire one sample at each iteration ?



0 Kudos
Message 17 of 18

Hi ggress1,


Yes, the DAQmx Read 1 Channel 1 Sample will read one sample each iteration. Because you have configured continuous hardware timed acquisition for the task, the DAQmx Read VI is reads data out of the hardware/software buffers, while the hardware timing controls the actual data acquisition. The link below discusses the various buffers DAQmx uses when acquiring data, in the context of overflow and underflow errors.


You can do hardware timed single point acquisition by changing the sampling mode to Hardware Timed Single Point and using the Read 1 Channel 1 Sample VI in the while loop. You can see an example of Hardware Timed Single Point Input in the Example Finder (Help >> Find Examples… >> Hardware Input and Output >> DAQmx >> Analog Input >> Voltage – HW-Timed Single Point Input).


You can also do software-timed single point acquisition by removing the DAQmx timing VI and using the DAQmx Read 1 Channel 1 Sample VI in your while loop. This will acquire and read a sample each time the loop runs. However, software-timed acquisition is subject to jitter because it relies on the operating system to time the acquisition rather than using a hardware clock.


Is there a particular reason you want to acquire only one sample each iteration? 

Catherine B.
Applications Engineer
National Instruments
0 Kudos
Message 18 of 18