ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sampling rate

I have a question about sampling rate. I have a program where I need to take measurement every 1 millisecond from a channel (10 samples in every 1  millisecond). So correct me if I am wrong.  Under the DAQmx timing, The sampling rate I set it as 10,000. The number of samples per channel I set it as 10. So the while loop will cycle every 1 millisecond and take 10 samples and gives a total sample of 10,000 per second. 

 

thank you. 

0 Kudos
Message 1 of 15
(3,317 Views)

That sounds correct. What exactly is the question? Have you tried it?

Message 2 of 15
(3,295 Views)

Thanks for the reply. I needed some validation from the experts here about my theory on sampling rate. 

Sorry I posted the question in a confusing way. All I want to do is to get values( at least 10 samples)  from a sensor on every 1 milli second. 

0 Kudos
Message 3 of 15
(3,289 Views)

@realbasil wrote:

I have a question about sampling rate. I have a program where I need to take measurement every 1 millisecond from a channel (10 samples in every 1  millisecond). So correct me if I am wrong.  Under the DAQmx timing, The sampling rate I set it as 10,000. The number of samples per channel I set it as 10. So the while loop will cycle every 1 millisecond and take 10 samples and gives a total sample of 10,000 per second. 

 

thank you. 


Is there a reason you need to get the samples every 1 ms; the overhead in calling that will likely make your VI time out. 100ms interval is a good choice, I would not try to access much less than 20-50ms, if absolutely needed.

 

mcduff

Message 4 of 15
(3,283 Views)

Mcduff

That is worrying for me. 

Yes, I need to look at the data in the interval of 1ms. The whole test last only 4 seconds. The pass/fail can depend on the value in 1 ms.  

0 Kudos
Message 5 of 15
(3,269 Views)

@realbasil wrote:

Mcduff

That is worrying for me. 

Yes, I need to look at the data in the interval of 1ms. The whole test last only 4 seconds. The pass/fail can depend on the value in 1 ms.  


What device are you using? If a USB Device, the latency will probably make this impossible.

 

For something like this you probably need a FPGA and a Real Time OS to handle a small interval.

 

What are you trying to measure?

 

mcduff

 

 

Message 6 of 15
(3,253 Views)

@mcduff wrote:

Is there a reason you need to get the samples every 1 ms; the overhead in calling that will likely make your VI time out. 100ms interval is a good choice, I would not try to access much less than 20-50ms, if absolutely needed.

Fully agree with the sentiment, but have been known to push the limits to 10 msec and less on *VERY RARE* occasions.

 

That said, I've seen many, many, many (many, many, many, many) threads from new and new-ish users who *think* they need really fast software loop iterations but who really need a more thorough understanding of their DAQ hardware & driver capabilities and a more realistic assessment of what they're looking to accomplish.

 

So what is it that *you* are doing here that would justify a need for a 1 kHz loop rate?  Spoiler: even if you have a legit need, I would not bet on fully satisfying it under Windows.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 7 of 15
(3,251 Views)

I am using cDAQ9185 and 9203 chassis. I am trying to measure the position. 

Thanks for the suggestions, I have to do more research on FPGA and Real time. 

0 Kudos
Message 8 of 15
(3,245 Views)

Do you have to look at the data in real time?  Can you capture more than what's needed (and at a larger chunk/slower measuring rate) and evaluate the data after the test, or is it such that in 10 ms it could crash into something?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 9 of 15
(3,230 Views)

You can *measure* with much more manageable loop iteration rates such as 10 Hz (100 msec).  This still lets you display and present data that's as close to real-time as human perception can distinguish.

 

It's only when you need code-based automatic *control* that you *might* need faster loop rates for decision-making and output generation.

 

So are you reacting and controlling something that needs near-instantaneous response or are you merely measuring?   If merely measuring (and that's all you mentioned), then it's highly doubtful you actually need loop iteration rates anywhere near 1 kHz speed.

 

 

-Kevin P

ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Message 10 of 15
(3,215 Views)