Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Acquiring the most current sample from a DAQ board

I'm trying to acquire an analog voltage using a PCI 6133 board using LabVIEW and NI-DAQmx. I have a bunch of low frequency (~ 30 Hz) signals that are fed into the board.

 

When the user presses a button on the front panel, I wish to acquire the most recent sample. Otherwise, I just want to acquire samples every 2 seconds. My acquisition loop needs to be as resource friendly as possible since we have multiple loops doing other acquisitions running simultaneously in different VIs on the same computer.

 

If I try using a "conventional" sample clock, DAQmx seems to buffer all unread samples. Instead, I want to read only the most current sample, one sample at a time. What's the best way of doing this?

 

Thanks.

 

Regards

Akarsh

0 Kudos
Message 1 of 2
(2,697 Views)

Are you using the DAQmx VIs?

 

I have built sample code that seems to do what you want. Just pick your channel under Channel Parameters.

 

Basically, I have created an event structure in a loop. The event structure has two events. One event is "Acquire New Sample: Mouse Up," which fires when the mouse is let go on the acquire button. In this event, you simply have a DAQmx VI that acquires one sample and outputs it to the Data indicator.

 

The other event is the Timeout Event. If nothing happens in two seconds (since the last sample was acquired, either by button or automatically), then a sample is automatically taken.

 

I'm not sure whether this will be compatible with your other VIs, or if you need that 2 seconds to be dead precise, but if you don't, this can work well.

Ravi A.
National Instruments | Applications Engineer
0 Kudos
Message 2 of 2
(2,682 Views)