04-24-2013
08:24 AM
- last edited on
01-09-2025
08:32 PM
by
Content Cleaner
Dear All,
I have used a shipped example from here: http://zone.ni.com/devzone/cda/epd/p/id/5028
My code works, but sometimes it gives me this error:
Error -200279 occurred at Barkhausen_DAQ_raw.vi Possible reason(s): Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten. Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem. Property: RelativeTo Corresponding Value: Current Read Position Property: Offset Corresponding Value: 0 Task Name: _unnamedTask<37>
Could someone give me a hint why we get this undesirable behaviour? I do my code as I saw in the official example, only I have a bit higher sample rate...
Please find my VIs attached.
Thanks!
Best Regards,
Solved! Go to Solution.
04-24-2013 09:09 AM
Additional information:
Every time, if I get the above error in my LabView VI, and I close LAbView and I turn off my PC, it crashes into BSOD, and aftter restart it gives me the location of a dump file (i attached it).
If I do not get error in my VI, I can turn off my PC without the blue screen of death.
When I get BSoD, I can see something like this for a second on the screen:
"Multiple IRP request......"
Is something broken in the driver, or the PCI MIO16E card is broken? (in MAX, self-test says it is OK).
Thanks for help!
04-30-2013
09:20 AM
- last edited on
01-09-2025
08:33 PM
by
Content Cleaner
This error occurs because samples have been overwritten by the DAQ card.
You could increase the buffer size, read the data more frequently and/or specify a fixed number of samples to read:
https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KTeSAM&l=en-US
04-30-2013 09:44 AM
hello, I have found the link what you have posted after I got the first error, since it directs to this page. However it does not help to understand the real cause of this kind of error. Specially, because my implementation seems to be exactly like the example VI for this kind of task.
So i need some deeper insight whats going on, the link is not useful at all.
Regards,
04-30-2013
05:42 PM
- last edited on
01-09-2025
08:33 PM
by
Content Cleaner
The example looks like it is based off of this one--both have the same flaws that somebody from NI should probably correct (or just move the developer zone example to the community and then we users can correct them for you instead ). The issue that you have encountered comes from how DAQmx uses default parameters to configure the buffer and the number of samples to read:
1) For a finite task, DAQmx chooses a default buffer size to be equal to the samples per channel property (the input to DAQmx Timing.vi--in your case, 20000 samples).
2) For a finite task, specifying -1 for the number of samples per channel input to DAQmx Read.vi results in reading back the number of samples specified for the finite task (the same 20000 samples mentioned in #1).
So, you can see the problem. You are constantly filling the buffer, but are only removing samples from the buffer in chunks that are the size of the buffer itself. If something happens in software that slightly delays the reading of samples from the buffer, you will end up overwriting data. The buffer needs to be larger to compensate (alternatively, you could specify a number of samples to the DAQmx Read call that is less than your number of samples configured for the finite task, but doing this seems like it would be a confusing way to go about it).
The other major issue with the example (it would lead to a different error) is the use of querying the task being done to determine whether or not to read the full amount of samples. What if the task finishes after the check has already been made and the read is still waiting for the full amount of samples to become available? You'll block for the full timeout of the read call and will get a timeout error, then wouldn't read the remaining samples at the end due to the error chaining (or actually I think the samples would be available on the Data terminal instead--but this inconsistency doesn't seem desirable--I don't really like blocking for a full 10 seconds waiting for data in any case).
There are also a couple minor issues with the example:
Well now I've gotten off on a tangent. The point is, there are some flaws in the example. I think this is a great use-case for DAQmx Events, and would have probably done something more like this (Warning, snippet is untested--it also doesn't have the extra counter stuff that your example did to divide down the ref trig source):
The fix to your specific problem is to configure the buffer (DAQmx Configure Input Buffer.vi). Here I went with 2x the number of samples read per loop iteration (should probably be enough, might need to come up with an algorithm based on sample rate though).
The other fixes are that the post trigger samples are now the minimum 2 (for faster stopping), a DAQmx event is now used to determine when to read the full amount of data (to prevent timeout of read after stopping), and the remaining data indicator is always updated (to prevent stale data from being displayed on the indicator in the case that there is no remaining data).
Hopefully I'm not missing anything else...
Best Regards,
04-30-2013 06:02 PM
FYI, I forgot to unregister my DAQmx events.
Best Regards,
04-30-2013 11:50 PM
Hi,
Thanks for the very clear and detailed explanation! This is why I love the discussion forum. 🙂 I am going to try the approach which you suggest.
I will give a feedback here just for the reference, as early as I have my revised version built and run.
Best Regards,
05-02-2013 08:31 AM
My program now runs without errors, thanks again for help!
I attach my subVI for the reference, maybe someone will find it useful in the future, or reuse in part...
Regards,