‎03-28-2013 08:47 AM
Hi,
I am looking for an easy way to simply get the latest value that is available at an analog input?
The application is a control loop, I am using a timed loop and want to read a single value (voltage) per iteration.
Do I need to use DAQmx Timing, DAQmx StartTask etc, or is it sufficient to create a channel and call DAQmxRead in the timed loop?
At the moment, I am a bit confused about all the options that are available especially with the DAQmxTiming vi.
According to the documentation, a buffer is created and the device fills this buffer with data, depending on the sample mode, sample rate and number of samples. The DAQmxRead later reads from this buffer.
I think in my case, I do not need a buffer,or, if this is not possible, the buffer length should be 1, since I always need the latest value, and no older values?
Is there a setting for DAQmxTiming, that makes sure that DAQmxRead gets the latest available value whenever it is called?
Thanks in advance,
Christian
‎03-28-2013 09:23 AM
Setup your task to be 1 sample on demand. I don't have LabVIEW immediately available, but you should be able to figure it out.
‎03-28-2013 09:59 AM
Hallo ChristianEC
I would say, just look in the example finder for the example "Cont Acq&Graph Voltage-Single Point Optimization.vi" In the Case structure choose the case "Read VI (stop after last iteration)". Thats all you need for reading one point per iteration. You do not need timing.
Just a "DAQmx Read" in your loop, and the "DAQmx start" and "DAQmx Create Channel" before and a "DAQmx" stop behind the loop.
Hope I could help
regards
Tobias
‎03-28-2013 10:27 AM
Hello TobiasK,
thank you for your reply, seems reasonable. I will try to get this running.
Christian