03-09-2014 09:20 PM
03-09-2014 09:32 PM
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.
Thanks
03-09-2014 09:41 PM
03-09-2014 09:52 PM
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.
Thanks.
03-20-2014 01:01 AM
Is this what you recommended ?
Suggestion for improving accuracy of 0.5 second intervals ?
thx
03-21-2014 08:30 AM
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?
03-21-2014 04:45 PM
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 ?
Thx
03-24-2014 01:11 PM
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.
http://digital.ni.com/public.nsf/allkb/A224DA0551EEA073862574F60060AB6F?OpenDocument
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?