LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Avoiding PC buffer overflow error - 200279

Solved!
Go to solution

Hi,

I need to avoid pc buffer overflow error in my code. When reading the following article, it is suggested that the read rate (DAQmx Read) and sample rate (DAQmx Timing) should be same to avoid this error.

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z0000019KTeSAM&l=de-DE

 

But going through the following article on DAQmx Timing and Sample Rates, it is recommended that the number of samples be 1/10th  the rate specified on the DAQmx Timing function (under Part 2 section). It would be nice if someone can explain the difference. 

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA00Z000000P7KdSAK&l=de-DE

 

Thanks.

Deepak

 

 

0 Kudos
Message 1 of 3
(2,366 Views)
Solution
Accepted by topic author deepak44

Both articles are far more comprehensive than this reply will be.  I think the key is to understand that they don't disagree with one another, not *really*, about sample rates, read rates, and # samples to read for a buffered task.

 

In the first article, the emphasis is that you must *on average* read samples out of the buffer at the same rate that sampling is putting them into the buffer.  The overall read rate needs to be the same as the sample rate.  And the correct formula to use for read rate is (samples / read) * (reads / sec), not the formula given in the first article.

 

The second article focuses on the (samples / read) part of that equation.  When you set it to 1/10th the DAQmx sample rate, you're essentially asking for 1/10th sec worth of data with every read.  As long as the DAQmx Read function is the thing that governs loop timing, you'll find that you have a loop rate that gives you 10 reads/sec.   Put together, you'll read 1 sec worth of data per second of sampling, thus preventing buffer overflow.

 

The following code illustration from the 1st link demonstrates such a loop, though you should be aware that its calculation of 'DAQmx Read Rate' is in units of samples/millisec:

 

 

-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 2 of 3
(2,351 Views)

@Kevin_Price

 

Somehow your explanation cleared my doubt rather than the articles. Since i clearly didn't understand well from the article that the read rate and sample rate should be same *on average*. 

 

Thanks and Best regards,

Deepak

0 Kudos
Message 3 of 3
(2,317 Views)