I am trying to take continuous samples of a square wave voltage source in order to determine the frequency. In order to do this I must have a sampling rate of at least 2000 if not more. The error that I am encountering is -200279, I have looked into this and understand that it is caused by buffer overflow, I have already attempted to increase the sampling rate, reduce the number of samples and increase the buffer size however all my attempts at some point give me the same error. The problem is that this is a program which needs to be run continuously for an unlimited period of time and must be updated rather frequently, therefore the task that I am opening is not closed until the program exits, which I am afraid means that the buffer is never being allowed to clear which causes this error, and I do not want to store the continuous data but go in every second or more and take 1000 samples to use.
I have also attempted to change the "RelativeTo" property to "MostRecentSample" which I thought had fixed the problem however after it ran for sometime I encountered the same error. I left the "Offset" property at the default 0.
If anyone knows how to fix this problem with something other than "increasing the buffer size," as eventually i believe the program being left on indefinitely will eventually overflow, any help would be appreciated. I have not tried playing around with the Timing Properties so if anyone can suggest anything regarding to the setting of these it would help. Lastly, I am considering putting in a counter of some sort to automatically clear and restart the task at a certain period of time, which I believe will clear the buffer, but I would like to avoid this if possible.
Attached is a screenshot of the code segment but its pretty generic. We have a USB drive hooked up to a cDAQ - 9172 with a NI 9206 Card reading the data.
Thanks for the help.