Hi everyone,
I'm hoping someone can help me. I'm still pretty new to this game so I could just be being dense but here's my problem.
I am designing a front-end for an experiment, it needs to encompass real-time control of a signal generator as well as managing data acquisition for the external system that the signal generator drives. I am presently using one analog output channel on an NI SCB68 board (via a PXI-6251 card in a PXI-1031 crate) and a few input channels, but will ultimately need mabe 10 input channels as well as a DMM (PXI-4071). I am currently sampling half a dozen input signals at something in the region of 500 Hz, and displaying these signals on graphs as a way of monitoring that they're working properly. I am also averageing every 500 samples and displaying them in a table (again to monitor the values are sensible) as well as writing them to a .lvm file.
I currently have all of this going on in a big while loop. It seems to work ok, but I occasionally get Error -200279:
Error -200279 occurred at DAQmx Read (Analog 1D Wfm NChan NSamp).vi:1
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: Relative To
Corresponding Value: Current Read Position
Property: Offset
Corresponding Value:
Take Name: _unnamedTask<48>
I think this is caused by my loop timing. The loop executes an express vi which samples all my input channel: say 1000 samples at 500 Hz, so therefore the loop has to take 2 seconds to achieve this. Could it be that the extra tasks my loop has to execute cause the loop to take slightly longer than 2 seconds, so there is a time delay which grows with each execution of the loop. Eventually the delay grows to be larger than the loop time and so it's not finished processing loop "n"'s data when the signals from loop "n+1" start (because the signals are read continuously)?
It's possible that's just a load of rubbish and I don't know what I'm talking about - henc why I'm asking on here 🙂
If it helps matters any, I don't get the error if I remove the NI-DMM express VI from my code.
I don't expect for one second that my code is anywhere near optimal, so if anyone has any advice on the best way to organise this kind of thing I'd be very happy to hear it. Would multiple while loops be the answer? Or does this not really solve anything?
cheers