LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx Read Available Samples

Sorry if this is a simple question, but I have been porting a LabVIEW VI to C code using the DAQmx library. I cannot find a function in the documentation to read the number of samps available from a continuous acquisition. The LabVIEW VI uses the property  node --> AvailSampsPerChan to read this. 

 

Just to be clear, we have a continuous acquisition running, and the main program loop continuously checks the number of samples available. When it reaches a certain number, the buffer is read and the process repeats.

 

Thanks,

 

Alex

0 Kudos
Message 1 of 4
(3,169 Views)

I believe I've figured out how to do this.

 

If you use DAQmxGetReadAttribute() to get the attribute DAQmx_Read_AvailSampPerChan, it will tell you the number of samples available to be read.

0 Kudos
Message 2 of 4
(3,143 Views)

Sounds like DAQmxRegisterEveryNSamplesEvent() might help you. This function executes a callback function that you specify each time N samples have been read into the input buffer. The callback function (that you create) processes the data.

 

There is an example CVI program that illustrates the use this function. I'm not currently on a computer that has CVI installed or I would find the name of the example program for you.

0 Kudos
Message 3 of 4
(3,117 Views)

Well I will try the readAttributes approach, the registerNSamples event does seem the obvious choice except that I am actually using this as an external library call in MATLAB so I'm not sure how to/if it's possible to use callback functions. Thanks!

0 Kudos
Message 4 of 4
(3,093 Views)