10-13-2006 01:08 PM
LabVIEW 7.1, Windows XP.
Buffered Reads / Lost Data
When error 10846 (AI Buffered Read, app unable to retrieve data from background acquisition buffer fast enough) occurs, I receive no data from the AI Buffered Read function for a period of time. The error states data may be lost but it seems like I get NO data. See the attached VI and JPG for examples. The bottom graph shows a normal read while the top graph shows one with this problem. I realize the AI Read error cluster is not handled in the acquisition loop. From watching the backlog while the program runs, it seems the “dead spots” occur after the backlog reaches the buffer size. When stopping acquisition, sometimes the error handler outside the loop reports 10846, sometimes it doesn’t (when the dead spots are occurring). I can exaggerate dead spots with setups as follows:
Buffer size 5, Scan rate 1000, # Scans to read 100
Buffer size 10000, Scan rate 5500, # Scans to read 100
The size of the dead spots and continuous data are proportional to the buffer size.
Questions....
1. Shouldn’t the AI Read function wait until it has # scans to read of valid data before returning? For instance, scan rate of 100 and # scans to read of 1000 slows loop iteration speed to 0.1 Hz. It seems like it is returning nothing for a period of time after the backlog reaches the buffer size.
2. Error 10846 refers to the “data acquisition buffer.” Is this the software buffer? If so, what would LV refer to the hardware buffer as?
3. I know the PCI-MIO-16E-1 has a hardware buffer, does this mean I can accurately acquire data over a period of time at a specified frequency (within limitations of the card of course) without having to worry about Windows bogging down due to delayed writes and such?
4. Will hardware acquisition buffers generate an error if the data in them is lost/overwritten?
5. I tried loading the acquisition VI (attached) onto a LV computer that has only a new USB-6008 connected but the AI read/config/clear functions were not available on that system. Does this device not have hardware buffers (either I’m looking in the wrong places to find the answer this question and it uses different VIs OR it doesn’t have them).
6. The buffer/scan configuration listed above was used to exaggerate error 10846 and the accompanying dead spots but this problem has been intermittently plaguing a system I have been trying to understand/fix. I have logged the backlog value as the program runs and see that it increases during certain processor-heavy state machine states and am hoping upgrading from 256MB to 2GB RAM will improve this. Is there any reason I should not look at this as a solution? (I am also planning on adding an error handler for AI Read into each acquisition loop so the problem can not continue to go on without detection!!!!!!!!!)
7. Shouldn’t the AI Clear function report an error from the AI Read error cluster, even if it happened several reads earlier? It seems like it does not do this; if I put the error handler in the acquisition loop I receive an error as soon as the backlog reaches the buffer size, EVERY time. I thought I figured this out and changed the acquisition loop tunnels to shift registers... the error is reported each time this way; if AI Read will not acquire data if an error is fed into it in the first place then I guess I understand this one so I’m moving it to the bottom of the list.
Thank you all for your time, I have been struggling to get up to speed with DAQ and LV and appreciate all the support. I look forward to giving back to NI’s community in the future.
Regards,
David.
10-16-2006
05:57 PM
- last edited on
05-09-2024
04:52 PM
by
Content Cleaner
Hello David,
Before we start discussing your questions I wanted to mention that you might consider using DAQmx instead of Traditional DAQ. The reason I mention this is because it sounds like you are just starting to use LabVIEW and DAQ. DAQmx is our newest driver and it was designed to improve on the Traditional DAQ driver. Not only is DAQmx much easier to use but it also faster and more powerful. The DAQmx driver is also smarter and can handle a lot of buffer issues for you. Traditional DAQ is still supported by LabVIEW and many of our devices, but any new devices that come out will use DAQmx.
Since you are using a PCI-MIO-16E-1 you have the option to use either DAQmx or Traditional DAQ. Unless you have a reason you might want to use DAQmx especially if you are just starting to program and are new to the driver. You can download the newest version of DAQmx (version 8.3) here: https://www.ni.com/en/support/downloads/drivers/download.ni-daq-mx.html
If migrating to DAQmx is not an option then please let me know and I would be happy to help you with your questions. I was going to try and see what your code looked like but it was not attached like you had mentioned in your post. So if migrating to DAQmx is not an option then you might want to include it on your next post. Or if you were modifying an existing example could you let me know what example you were using?
Have a great day,
Brian P.
Applications Engineer
10-19-2006 12:42 PM
10-20-2006
05:15 PM
- last edited on
05-09-2024
04:52 PM
by
Content Cleaner
10-22-2006
02:16 PM
- last edited on
05-09-2024
04:53 PM
by
Content Cleaner
@wildcat_600 wrote:
David,LabVIEW should generate an error if data is overwriten before it is read. I generated this error on my PC and the error that I received is Error -10486. I attached a screenshot of this error below. If you still want to use Traditional DAQ then you might want to also look at the example programs that ship with LabVIEW. Example programs are a great resource to see how to use the Traditional DAQ VIs to create a working VI.I wanted to point out a few fabulous documents that can help you better understand the differences between Traditional DAQ and DAQmx. Within these documents are even more great links that you might want to look at as well. These links really go indepth and explain very well the reasons why to make the switch and also help you better understand how you can implement the transition.Answers to Frequently Asked Questions about NI-DAQmx and Traditional NI-DAQ (Legacy)(pay attention to the Upgrading from Traditional NI-DAQ (Legacy) section)Transition from Traditional NI-DAQ to NI-DAQmxI hope this answered the question that you have. If you have any other questions that I can assist you with please let me know.Have a great weekend,Brian P.Applications Engineer
10-25-2006 04:57 PM