Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmx circular buffer

I understand that DAQmx has built-in circular buffers for analog I/O.  This sounds good, but I need more detailed info on how to use them.  For instance, what happens when the buffer gets empty but you're still trying to read from it?  What happens when the buffer gets full but you're still trying to write to it?
 
My goal is a feedback control loop.  I want to send out an analog waveform, read back an analog response, so some computation on blocks of about 1000 ADC samples at a time, and modify the analog output waveform based on the results, without any interruptions to the continuity of the output waveform.
 
0 Kudos
Message 1 of 3
(5,379 Views)

Hi jmoses-

You are correct- NI-DAQmx uses circular buffers for input operations and you have to be concerned about buffer contents and whether you're going to over- or underrun.  NI-DAQmx is really great about not letting you do this; errors will be thrown whenever either conditions occur.

For buffer overrun errors you will see error -200279 that indicates when samples have been overwritten without being read from the buffer:

For buffer underrun errors (i.e. DAQmx Read timeout errors) you will see -200284 which indicates that samples you requested have not yet been acquired.  By controlling the timeout of the DAQmx Read you can make the read function wait any amount of time before an underrun occurs.

Updating analog output operations on the fly requires that you disable onboard device regeneration to prevent the output buffer from looping and to allow new data to be read.  You didn't indicate which ADE and DAQ board you are using, but there is a great LabVIEW example called "Cont Gen Voltage Wfm-Int Clk-Non Regeneration.vi" in the NI Example Finder (Help>>Find Examples in LabVIEW) under Hardware Input and Output>>DAQmx>>Analog Generation>>Voltage. 

The property you need to set to disallow regeneration in C programming is "DAQmxSetWriteRegenMode" as documented in the NI-DAQmx C Reference Help (Start>>Programs>>National Instruments>>NI-DAQ).

Thanks-

Message Edited by Tom W. on 08-04-2005 02:55 PM

Message Edited by Tom W. on 08-04-2005 02:56 PM

Tom W
National Instruments
Download All
Message 2 of 3
(5,364 Views)

https://engineering.purdue.edu/~aae520/Labview_manuals/DAQBasic.pdf

 

Search for keyword 'Circular'... This manual is pretty old version but it has presented the topic in great detail.


I am not allergic to Kudos, in fact I love Kudos.

 Make your LabVIEW experience more CONVENIENT.


Message 3 of 3
(4,388 Views)