Jump to content

DAQMX read problem


DDAdevil

Recommended Posts

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.

Link to comment

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

Link to comment
...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

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.