12-10-2009 04:25 PM
Hi,
I'm using a NI6537 for fast Digital Acquisition. The board is installed on a NIPXIe-1062 crate controlled by a NI PXIe-8130 controller, where the software is running. I'm reading all the 32 lines as a single channel, at 50MS/s, and the clock is the one provided by the board itself. I put the timeout as infinite, but I also tried various other settings. As I'm reading a finite samples bunch of 524288 samples, at 50 MS/s, a timeout of 1 second should be by far sufficient.
As far as I put the DAQmxReadDigitalU32(...) call in a simple loop I have no troubles, everything working fine.
for (...) {
DAQmxReadDigitalU32(...);
} // That loop works perfectly
while, if a have a loop inside a multi-thread process, or simply I give the system some freedom inside the loop, sometimes I get the timeout error. Note that the time cost of the Sleep() function is just of some millisecond, so there is no reason for the call to timeout.
for (...) {
DAQmxReadDigitalU32(...);
Sleep(1); // To release system resources...
}// That loop stops erratically
With the last code, I can also see that actually the board did not complete the reading, i.e. is returning less samples than what requested. It seems to me that someting is stopping the acquisition, but I'm not able to figure what. The same happens even in LabView, using the VI read: sometimes the read randomly generates a timeout error and stops, even if LabView is the only running application.
Could you point me what I'm doing wrong?
Thanks, Piero.
Solved! Go to Solution.
12-14-2009 06:52 PM
Hello Piero,
I am not sure how you built up your code in labVIEW, but I have been unable to reproduce this. The error that you posted though is indicative of a buffer underflow and we timed out. How many samples are you requesting to be returned with your DAQmxReadDigitalU32? In the code that I have built up, I simply have left the timeout to the default 10 seconds and have just requested all the samples avaliable in the buffer. I read off chunks from the buffer until I have hit the desired 524288 samples and then I break out of my loop.
This error most likely indicates that you are requesting a specified number of samples and have not yet aquired them in the timeout that you have defined. Please post back if these suggestions do not help.