LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

daqmx Available Samples Per Channel not zero

Solved!
Go to solution

I have a query here.

What if my Available Sample per Channel value is continuously in 500 range and it comes down to 0 and again goes back to 500 range. This phenomenon is happening continuously.

Does that mean my acquiring rate is too fast that in some of the iterations I am not getting any data and while other time data is available.

 

Also, as discussed in above post, what if the number keeps on increasing. What does it mean?

Does it mean that I have all data available but it is used too slowly in the program that my data in channel is continuously getting stacked.

 

Help me out with above queries.

 

 

0 Kudos
Message 11 of 19
(819 Views)

Hi Aditya,

 


@AdityaAbhishek wrote:

What if my value is continuously in 500 range and it comes down to 0 and again goes back to 500 range. This phenomenon is happening continuously.


Which "value" are you talking about?

How are you reading the DAQmx sample data?

How did you  configure your DAQmx task?

 

Mind to provide a VI demonstrating your problem?

In case you are talking about the "avaliable samples": why is it a problem to have ~500 samples available and sometimes just "down to 0"?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 12 of 19
(811 Views)

You still have not attached your code.  We assume you know how to properly code simple DAQmx tasks, but this assumption appears to be false.  We can "guess" what you are doing that is not correct, but that is a waste of our time, and also a waste of your time.

 

Please attach the VI (not a picture of the VI), or, much better, compress the Folder containing your entire LabVIEW Project and attach the resulting .zip file.  We should quickly be able to find your mistake and explain to you how to properly code DAQmx to get the results you desire.

 

Bob Schor

0 Kudos
Message 13 of 19
(795 Views)

IMG_20200812_154554.jpg

I can't share the code as I don't have access to it. Although, I can share the picture of it.

The above picture can help you out.

0 Kudos
Message 14 of 19
(781 Views)

PFA

Download All
0 Kudos
Message 15 of 19
(779 Views)

Hi Aditya,

 

so first you read samples from DAQmx, emptying the DAQmx-internal sample buffer, then you read the number of available samples.

And now you wonder why sometimes the buffer is reported empty AFTER you read the samples from the buffer!?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 16 of 19
(764 Views)

Hi GerdW,

It's means I am programmatically doing correct. And this is how I should read the DAQ internal buffer. Also, if even eat after reading the buffer, the samples keeps on increasing, then I am not reading complete buffer at a time and I need to increase the rate.

 

Regards,

Aditya

0 Kudos
Message 17 of 19
(741 Views)

Hi GerdW,

 

What is correct rate of DAQ aquiring?

Is after reading the DAQ, my Available Sampling Value should come to zero and again fill to same range of value OR if it should remain at same range of values continuously. Overall, it should never keep on increasing as it will lead to Buffer overflow.

I am asking this query because I have observed that after 2-3 hours of program running, all of a sudden this value starts increasing at a very fast rate. 

Can some one guide what can be possible issue. Please refer the pictures shared earlier for code.

 

Thanks & Regards,

Aditya

0 Kudos
Message 18 of 19
(721 Views)

Usually when tasks run fine for quite a while and then suddenly cascade into a buffer overflow error, there are some bad coding practices to uncover and fix.  One example is an array that can grow without bound -- eventually it becomes time consuming to allocate new memory, and so the app gets stuck and doesn't call your DAQmx Read function as often as it needs to.

 

Over the long haul, it's necessary that your application retrieves data from the buffer (via calls to DAQmx Read) at the same AVERAGE rate as the hardware sample rate.  In the background, the DAQmx driver manages the process of pushing data *into* the buffer from the device., and that's getting pushed in, on AVERAGE, at the hardware sample rate as well.

 

Think of a boat with a slow leak. Water is constantly trickling into the boat at a regular rate.   This is like DAQmx pushing data into the buffer.  You're in the boat with a 5 gallon bucket.   Every once in a while, you scoop up a few gallons of accumulated water and dump it over the side.  If the leak flows in at 1/60 gallon per second then you need to dump water at a gallon per minute to keep up.   This is like your application.  You need to remove data from the buffer at the same average rate it's coming in, without every having a long enough idle period for the buffer to overflow (or the boat to sink).

 

 

-Kevin P

    

 

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
0 Kudos
Message 19 of 19
(707 Views)