LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ USB-6001 Sample Rate 20kHz error -200279

Hello helpers,

 

I have a problem with my NI USB-6001 device and LabVIEW 2012. I want to aquire data from an analog input which is acutally a potentiometer and from the counter input which gets its edges from a 24-increment encoder from a asynchronous motor. The motor can speed up to 3000 1/min = 50 1/s makes 50 1/s*24 Edges per revolution =1200 Samples/s  I need. The input works quite well, until I exceed my sample rate over 1kHz. Then after a while I get the error message:

 

error -200279
"The application is not able to keep up with the hardware acquisition."

This is because my "While Loop" needs more than 1ms for each iteration. As well my data which is shown "live" in waveform delays after real time. I tried to use a "Timed Loop" but the MHz button is greyed, so not choosable. I think that must be possible on an windows system.

 

I read a lot of other forum requests but I'm not able to fix that problem. I would be pleased if someone could help me with that problem.

 

Greetings

Marco

0 Kudos
Message 1 of 5
(3,984 Views)

Hi boma,

 

welcome to the forum!

 

When you want to read at a certain sample rate you should/need to set this sample rate in the DAQmx task using DAQmxTiming function!

As I just noticed you already set a sample rate: you should read more than just one sample per call of DAQmxRead!

Usually you read 1/10 the sample rate, at 1000S/s you should read blocks of 100 samples resulting in a loop rate of 10Hz…

 

There are example VIs explaining how to use those DAQmx function - just pick another one!

 

Another notes on your VI:

- don't use local variables when you can use a wire instead!

- use shift registers instead of local variables or (even worse) "value" property nodes!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 2 of 5
(3,935 Views)

Hi Gerd,

 

Thanks for your fast respond.

 

I changed the DAQ to aquire N-samples (1000) with a frequency of 10kHz. Also I built RMS after aquiring data. Therefore I get values only every 0.1sec - that's not really what I want. Is there a way to plot that 1000 samples with an timestamp of 0.1ms so I can use the full resolution? 

 

However, I don't get your point with the N samples. Where is the difference between sampling with 10kHz and take 10 samples and measure with 1kHz and taking 1 sample?

 

The timed loop I use now isn't working well, that the loop works every ms. So I think I didn't get that point to.

 

I attached my changed VI.

 

Greetings

Marco

 

0 Kudos
Message 3 of 5
(3,924 Views)

Hi Marco,

 

Also I built RMS after aquiring data. Therefore I get values only every 0.1sec - that's not really what I want. Is there a way to plot that 1000 samples with an timestamp of 0.1ms so I can use the full resolution?

Then why do you use the RMS at all - without it you would get the full 1000 samples you are reading now! (Homer says "Doh!" :D)

 

Where is the difference between sampling with 10kHz and take 10 samples and measure with 1kHz and taking 1 sample?

There's no real difference: both options will use the CPU very heavily due to those 1kHz read operations!

That's why I suggested (the common way of) reading with blocksize of 1/10 of sample rate! It will use very low CPU time!

 

The timed loop I use now isn't working well, that the loop works every ms. So I think I didn't get that point to.

In a common Windows OS environment you will get a high jitter with loops timed with just 1ms, either usual While loops or the TWL.

When you want to read at 1kHz with low(er) jitter you would have to use a RT environment like is provided with cRIO or myRIO targets.

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 4 of 5
(3,911 Views)

Another advantage of sampling at 10KHz and taking 1000 samples at a time, using continuous Acquisition, is that you introduce a hardware clock based on your DAQ hardware into the loop, making it "auto-clock".  Suppose you have a While Loop with a DAQmx Read function to take 1000 samples at a clock rate of 10KHz.  When you start the loop, let's say it takes 0.1" to get those 1000 samples.  You pass them to something that doesn't take much time, let's say 25msec, and the loop finishes, having taking 125 ms to execute.  You start the second loop, and you hit the DAQmx Read.  Well, it "waits" 75 msec until all the samples are present, gives them to you, and you again "process them".  Do you see what will happen?  Your While Loop (after that first iteration) will basically take 100 msec per cycle, just what you want, without you having to add Timing or additional "Wait" functions.

 

If you are using Express VIs, do a Web search for "Learn 10 Functions in NI-DAQmx" which will introduce you to using real DAQmx functions (such as DAQmx Read) instead of Express VIs.

 

Bob Schor

Message 5 of 5
(3,907 Views)