11-15-2007 09:04 PM
11-19-2007 04:14 AM
11-19-2007 10:54 AM - edited 11-19-2007 10:55 AM
Hello AndrewInOz (err... Australia),
KostasB shows the way to clear the error, however it is troublesome to me that
the error is occurring at all. From your description, it appears that the
circular
buffer is getting filled at a slightly faster rate than it is getting read
(which would explain the overwrite error after an extended period). If you
are reading a full seconds worth of data each time (samples to read), then your
loop would have to be running slower than that (one second) for this to
happen. That is a very long iteration time.
The easiest solution for this, assuming the length of time is most important,
is to use a finite acquisition (N points) where you sample 1 seconds worth of
data (e.g. 100 points at 100Hz). If you put this is a loop, each time it
runs it will output one seconds worth of data. This pretty much
guarantees that you would not receive a buffer error since it would reset the
buffer each loop.
If you would like to acquire continuously and then average your points, then
you could use an array as kind of a storage bin for your data. This way
you could read a large amount of data out of your buffer (your DAQ assistant)
and append that to your array. You could then use your iteration marker
to read a seconds worth of data and take your average:
The trick with this is that the data array could get very large depending on
your sampling rate. I hope this helps, let us know what you do and if it works!