Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

How small buffers can I choose for double-buffered data input using PCI-6034E

Hello, everyone

I will appreciate the help from you about how to use PCI-6034E to obtain runtime data. I use Vitual C++ and NI-DAQ functions. What I want to do is to sample three analog channels in a measurement computer, do calculation on the collected data every 0.01 second , and deliver the results immediately to another computer through serial port. In the measurement computer, I use double-buffered data input and choose a full buffer size of 60 samples and a half buffer size of 30 samples. The sampling frequency is 3000 Hz and I scan three anolog input channels. Based on this configuration, every 0.01 (30/3000=0.01) second I have to move data from the full buffer to the half
buffer and do calculation. The problem is that the sampling is always stopped by the dialogue as following.
---------------------------
NI-DAQ warning
---------------------------
[DAQ_DB_HalfReady] returned NI-DAQ warning 10846.

Your application was unable to retrieve data from the background acquisition buffer fast
enough so the unretrieved data was overwritten with new data. To prevent this error, you
might increase the size of the background acquisition buffer, increase the amount of data
you read from it per call to the read function/VI, slow down your acquisition rate, or reduce
the number of tasks your computer is performing.
------------------------------------------------------

I wonder if the buffer sizes I choose are too small and how I can obtain runtime measurement data, such as every milisecond or even fast. Does LabView has similar functions?

Thank in advance.

Le Cai
0 Kudos
Message 1 of 2
(2,693 Views)

Hello Le Cai,

I am posting my response to your email here in case anyone else might find it useful.

Thank you for contacting National Instruments. I suppose the error message you received describes the situation very accurately. It means that your software loop is not fast enough to retrieve and process the data without your buffer overflowing. There are several things you have control over.

1) You can, as you said, increase the buffer size. This would allow your program to process more data per loop cycle which would increase efficiency. For example, you could double the size of your buffer and half buffer and thus generate two outputs to your serial port per loop iteration.

2) You could somehow improve the efficiency of your program.

- Typically, one common reason for this error is trying to do too much data processing within the same loop that you are trying to acquire the data. There are a couple of ways around this. 1) You could acquire all the data first and then process and generate all of your outputs. (But I don't think this is applicable in your application.) 2) Create a separate thread that processes and generates your outputs. This would free up your other loop(thread) to specifically concentrate on acquiring the data.

- You also try to trim down any unnecessary function calls within the loop, but if the NI-DAQ functions were somehow more efficient, this would also help. Actually... we now have a new NI-DAQ driver that we intend to replace the one you're using with called DAQmx. (It's installed with the latest download, NI-DAQ 7.1)

This API is MUCH faster than Traditional NI-DAQ. Some of our benchmarks mark loop rates to be capable of a 20x improvement. I would consider this one of your best options.

3) To answer your question about LabVIEW, yes, it's possible that simply using LabVIEW could improve your performance in this type of application. The reason is because LabVIEW uses a special set of functions that allow you to pull data out of the buffer in increaments other than just half buffers. This way, you could increase your overall buffer size to protect against the 10846 error and at the same time, still only pull out of the buffer 30 samples at a time.

Best Regards,

Russell
Applications Engineer
National Instruments
http://www.ni.com/support

Message 2 of 2
(2,693 Views)