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.
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.
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?
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 ?
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?