01-07-2014 02:49 PM
Im using LabView 2010, and everytime I go to gather data using my VI, after a few minutes of data, I get an error stating buffer overflow, and the data acquisition stops.
How can I get it to stop doing that?
Also, my VI is setup to do 10 samples per second and output an average of those 10...then I need 10 averages per minute. It doesnt seem to be doing that part correctly. Can someone advise me how to fix it?
Solved! Go to Solution.
01-07-2014 03:20 PM
Attach your VI. Give us some examples of your data rates. Are you doing anything else in the loop such as writing to a file after acquiring data? What DAQ card are you using?
01-07-2014 03:21 PM - edited 01-07-2014 03:22 PM
Well its hard to see what you are doing wrong without the code. (You can attach an example of the code causing you the problem)
The error you are getting means that the DAQ device is taking samples far faster than you are reading the samples. Eventually the DAQ onboard memory (Buffer) fills up with all that old data you never read.
Knowing that, the potential fixes boil down to:
01-07-2014 03:45 PM
@RavensFan wrote:
Attach your VI. Give us some examples of your data rates. Are you doing anything else in the loop such as writing to a file after acquiring data? What DAQ card are you using?
I have a sampling rate of 1000 Hz and 100 samples per channel. I have a cDAQ with all 4-20mA inputs. I am using the DAQ Explorer to setup each channel and the scaling.
Yes, I am writing to a file and displaying the data for each channel at the same time (I only have 5 channels setup in the code).
01-07-2014 04:08 PM
Channeling my inner Altenbach:
Your code makes no sense!
you get "Signals" from the DAQ Assit loop and pass them to the main acq loop. Now, that data in "Signals" can never ever change no matter how many times the main loop iterates so tossing them into a collector and taking the mean simply chews up memory to get the same result out as in. EVERY TIME! how many times do you need to write that value to file?
01-07-2014 05:28 PM
@JÞB wrote:
Channeling my inner Altenbach:
Your code makes no sense!
you get "Signals" from the DAQ Assit loop and pass them to the main acq loop. Now, that data in "Signals" can never ever change no matter how many times the main loop iterates so tossing them into a collector and taking the mean simply chews up memory to get the same result out as in. EVERY TIME! how many times do you need to write that value to file?
I tossed this together between projects without really knowing what I was doing - yes I know it makes no sense. The point is it worked good enough for the first project that it was used for. But "worked" is not good enough for this next project.
I need to write the values to the file each time I do the average of 10 samples. I know there is a better, cleaner way of doing this code, but sadly, I just havent had any time to learn my way through doing this myself. Any help improving this and fixing that buffer problem is much appreciated.
01-07-2014 07:00 PM
01-07-2014 07:09 PM - edited 01-07-2014 07:27 PM
@JÞB wrote:
Start by getting rid of all the xvis I think I showed that all of that code serves no useful purpose. don't. replace them with any functions, just toss out the blue icons. Ctrl space ctrl r. poof gone. The rest will work out fairly easy once those hogs are no longer slowing down useful processes.
Done. What about the DAQ Explorer that sets up the channels and brings in scales from the cDAQ software? How do I replace that?
01-07-2014 09:15 PM
Not sure what you mean by DAQ explorer. Are you talking about Measurement and Automation Explorer? If so, you don't replace that. And it doesn't exist as an item within a LabVIEW VI. It is a separate piece of software on your PC. Once you set up your cDAQ in that, including channels and scales if you want, you just pick your channels, or pick your task when you drop a control or constant down on your LabVIEW block diagram. Right click the first purple wire and create constant, now wire that in to the first DAQmx VI instead of the purple wire coming from the Express VI, which you will be eliminating anyway.
You might want to read the resources available here. Getting Started with NI-DAQmx: Main Page
01-08-2014 08:09 PM
Looks like its working better than before. No more buffer overflow errors, now that I got rid of those blue boxes in the loop.
I still would like to clean the code up a little bit to make it look nice, and add more features...but this is good enough for now. I have a customer coming in next week to witness a test and sadly, once again, just dont have the time to improve it right now.
Thanks all for the help.