Jump to content

Question about DAQmx


Recommended Posts

Hi everybody,

I need help for setting the rate for DAQmx. I have an application and I need to acquire data at 200 samples/sec. I did use the dynamic VI to do Data Acquisition which is seperate with the main VI. My problem is I don't know how to set the timing right. I try to set number of sample per channel to 200 and the rate in DAQmx Read to 200, but I received the error.

Error -200279 occurred at DAQmx Read (Analog 1D Wfm NChan NSamp).vi:2

Possible reason(s):

Measurements: Attempted to read samples that are no longer available. The requested sample was previously available, but has since been overwritten.

Increasing the buffer size, reading the data more frequently, or specifying a fixed number of samples to read instead of reading all available samples might correct the problem.

I don't quite understand relation between the number of sample per channel with the rate.

I attach here my screenshots.

Thank you so much for your time reading this question.

Thang Nguyen

Link to comment

QUOTE(tcplomp @ Mar 1 2008, 12:44 AM)

Hi Thang,

Your timing is ultra critical.

You wait one second to capture one second of data.

If you remove the 'wait 1000 ms' primitive you wouldn't have problem. The Read function will force the wait for you.

Good luck,

Ton

Ton,

The rate = 200, does it mean 200 samples/sec? Actually I try not use the delay before, but I still get the error. So I am quite confuse about this setting time.

Link to comment

QUOTE(Thang Nguyen @ Mar 1 2008, 05:14 PM)

Ton,

The rate = 200, does it mean 200 samples/sec? Actually I try not use the delay before, but I still get the error. So I am quite confuse about this setting time.

Normally yes, the samplerate is given in sampel per sec.

What is 'setting time'?

Another question how often is the Read daq case run?

It should run every second once.

Ton

Link to comment

I need to confirm that I understand right or wrong:

If at the setting time DAQmx, I put Continuous Samples at the sample mode input,and set a constant rate x samples/sec, it means that the system will polling countinously with that rate into a buffer, and the data will be changed by the rate.

Or when ever the program meet the DAQmx, it will wait for 1 sec to get enough data for the rate then return the data?

But what is the relation between rate with samples per channel? If the buffer is full, will data be refilled from the start of the buffer. Where we can set the size of the buffer?

Thank you,

Thang Nguyen.

In the second picture, I use a timeout for the queue to make the data acquisition run continuously.

Link to comment

QUOTE(Thang Nguyen @ Mar 2 2008, 08:33 PM)

If at the setting time DAQmx, I put Continuous Samples at the sample mode input,and set a constant rate x samples/sec, it means that the system will polling countinously with that rate into a buffer, and the data will be changed by the rate.

Or when ever the program meet the DAQmx, it will wait for 1 sec to get enough data for the rate then return the data?

The system (DAQmx) is constantly (continious) filling up the buffer with a rate of 200 samples per second. If you read it too slow (like you did), you will get the error you had.

QUOTE

But what is the relation between rate with samples per channel? If the buffer is full, will data be refilled from the start of the buffer. Where we can set the size of the buffer?

You get the error because your buffer is full.

If you open up the help for the 'DAQmx timing VI' you will see that the buffer is set automatically, but it can resized with the buffer settings. The standard buffer is OK for 5 seconds (if I recall correctly).

QUOTE

In the second picture, I use a timeout for the queue to make the data acquisition run continuously.

Please verify how often you read out the buffer in your program.

Ton

Link to comment
  • 2 weeks later...

QUOTE (Thang Nguyen @ Mar 14 2008, 11:37 AM)

Hi,

I want to ask a question.

Is it true that the program will wait for 1 sec to get data for the first time reading the number of samples set by the rate? So in this case the whole system will be late by 1 sec. Is it true?

Thank you

The program will wait for as long as you've specified in the "Timeout" input to DAQmx Read, according to the help file. In your case if your sampling speed is 200 samples/second and you want 200 samples, then you will have a 1 second wait (but if for some reason the acquisition is delayed you could be waiting up to 10seconds since that's what you're using as a timeout value). You could set the timeout to 0 and then you might not read all 200 samples on the first try but you won't be late.

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.