DDAdevil Posted July 12, 2007 Report Share Posted July 12, 2007 http://forums.lavag.org/index.php?act=attach&type=post&id=6341http://forums.lavag.org/index.php?act=attach&type=post&id=6341Hi 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. Quote Link to comment
ASTDan Posted July 12, 2007 Report Share Posted July 12, 2007 Hello, Is your read code in a while loop? If it is what is the udate rate of the while loop? Dan Quote Link to comment
Ton Plomp Posted July 12, 2007 Report Share Posted July 12, 2007 Hi I don't think it it neccesary to use the DAQmx property node I've never used it. I suppose your calculation takes longer than 1/4 of a second that's why you get the error. Normally I just read all the samples (-1). It is very unlikely to get an error that way. What else is in your while loop? Ton Quote Link to comment
Matheus Posted July 12, 2007 Report Share Posted July 12, 2007 Hello, I've never used Property Node for this case! I usually use... below.... http://forums.lavag.org/index.php?act=attach&type=post&id=6343 You must be careful with the while loop, try to use WHILE TIMED LOOP sometimes, can be a good way. Good Luck... Quote Link to comment
Kevin P Posted July 18, 2007 Report Share Posted July 18, 2007 ...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... I've done this kind of app before -- let the card perform continuous A/D so that my app can at any time request some of the samples. I'm not certain it was necessary, but I recall that I configured one of the DAQmx property nodes to "allow buffer overwrite" while setting up the continuous data acq task. Despite setting this property, I was surprised that DAQmx still gave me errors if I let the task churn away on A/D conversion in the background without requesting data for a while.So the other thing I did was to set "RelativeTo" = "MostRecentSample" and "Offset" = -(# to read). That combo would give me the most recent chunk of data that was already available in the buffer, without having to wait. I found I could let the task churn for several buffer fill intervals before reading data without getting the buffer overwrite error. I'm not 100% sure of the interaction between those properties and the behavior of the error codes though. I'd have thought your approach with Offset=0 should be ok too, it'd just make you wait for the most immediate future data. Anyhow, you might try these things and see if they help your app. -Kevin P Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.