01-12-2004 09:44 PM
01-14-2004
11:59 AM
- last edited on
07-14-2025
04:06 PM
by
Content Cleaner
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