LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Best solution to simply get the latest value at analog input

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

0 Kudos
Message 1 of 4
(2,801 Views)

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.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 4
(2,788 Views)

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

Message 3 of 4
(2,769 Views)

Hello TobiasK,

 

thank you for your reply, seems reasonable. I will try to get this running.

 

Christian

0 Kudos
Message 4 of 4
(2,761 Views)