Data buffer vs realtime VDT2 read?
aperson
My questions are:
1. Do you think that this sounds like a buffer problem and if so...
2. is it possible to clear the buffer within Igor between calls? And if so, how? (since I'm just using very dumb terminal read, I'm not writing anything to the Arduino, so I don't think I need to clear the buffered data from there.)
3. Eventually I would like to be able to update the wave continuously in a realtime data acquisition mode while plotting it. Will the calls like VDTReadWave2 work for this kind of application? I am generally confused about the relationship between buffer size and the time it takes to get new data into a usable form (like in a wave) and I want to minimize the delay.
Thanks and sorry if this is a bit garbled. I'm new to serial IO, so if these questions make any sense, the more info you can provide the more I can work to help myself!
-ap
The buffer size setting depends on support from the serial driver or OS, I'm not sure which, and I believe that it is usually not supported and does nothing.
The most straight-forward explanation is that the arduino keeps sending data and it gets buffered. Normally this is what you want as it prevents dropping data.
If you want to drop data then you would normally do a VDTReadBinary2 call to read the number of bytes you want to drop. But it sounds like you want to drop all data that may have accumulated, though I'm not sure why.
Yes. Execute "VDT2 killio".
It will work so long as you can read the data before it overflows the buffer. This depends on the rate at which data is coming in, what you are doing in Igor, and what the OS is doing. It is likely to work only for pretty-slow data rates - perhaps 100 Hz.
If you want to use Igor while data is being acquired then you need to use a background task. This is more difficult programming and you should not attempt it until you get it working from a simple user-defined function tight loop.
The buffer size has nothing to do with the time it takes to get data. It only relates to what happens if the device is sending data faster than you can read it. Either it gets buffered or it gets dropped. In the latter case, usually, your receiving software gets out-of-sync with the sending software and winds up waiting for data that never arrives. Then it hangs unless you use a timeout via the /O flag.
October 9, 2014 at 10:35 am - Permalink
October 9, 2014 at 10:37 am - Permalink