11-03-2020 09:32 AM
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.
11-03-2020 10:02 AM
That sounds correct. What exactly is the question? Have you tried it?
11-03-2020 10:12 AM - edited 11-03-2020 10:12 AM
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.
11-03-2020 10:14 AM - edited 11-03-2020 10:19 AM
@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
11-03-2020 10:27 AM - edited 11-03-2020 10:30 AM
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.
11-03-2020 10:45 AM
@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
11-03-2020 10:48 AM
@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
11-03-2020 10:58 AM
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.
11-03-2020 11:26 AM - edited 11-03-2020 11:27 AM
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?
11-03-2020 11:40 AM
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