04-09-2020 12:44 PM
I have an apparatus that rotates. It has an optical sensor interrupted twice/rotation.
I want to measure the speed of a rotation.
Hardware: NI-9402
LV2019
I am not sure exactly what the data is coming out of the counter.
Please help
Solved! Go to Solution.
04-09-2020 02:07 PM
Or would this be the proper way to measure time of a rotation?
04-09-2020 06:18 PM
I'll take a look if you do File->Save For Previous Version back to LV 2016. I can't open your 2019 version file.
Generally though, you might want to look into Frequency or Period measurement under Help->Find Examples...
-Kevin P
04-10-2020 10:39 AM
Thank you!
This should be a V.16
04-10-2020 03:58 PM - edited 04-10-2020 03:59 PM
Have you tried looking at the shipping examples?
I modified the code you attached. I enabled the freq measurement you had disabled and disabled the edge counting you had enabled. I set it up to read just 1 sample at a time. Because the counter was configured for frequency measurement, that 1 sample value will represent a frequency. Specifically, it's the time between consecutive rising edges of the signal specified at CI.Freq.Term. If I understand correctly, that'll be 1/2 rev for you.
Counters are very flexible and there are many other possible approaches that can get you useful data. I just wanted to illustrate a simple approach that made minimal mods to your code.
Check out the examples as well, you can learn quite a bit by running them, examining them, and figuring out why they behave the way they do.
-Kevin P
04-14-2020 06:24 AM
Thank you.
I had it disabled to try something else. I had initially used that code albeit with different parameters.
I was just not sure what exactly was the data coming out. Seconds, Hz?
If I understand correctly, it is sending out Frequency, Hz.
If I reciprocal that I will have the units in seconds, correct?
04-14-2020 08:22 AM
When you call DAQmx Create Virtual Channel to configure a frequency measurement, there's a wire-able input to specify units. The default value if left unwired is Hz. The reciprocal will be Seconds.
You could also configure a period measurement where the default units would be Seconds and the reciprocal would be Hz. Down at the hardware level, the counter behavior is the same. It's just the DAQmx that will translate the time interval measurement according to how you configured the channel.
(And don't try this at home while you're still new to counters, but if you call the version of DAQmx Read that returns 32-bit unsigned integers, you'll always just get a raw count value whose meaning is totally up to you to interpret, depending on how everything's configured.)
-Kevin P
04-17-2020 06:22 AM
It appears to be working. Difficult with not being in front of the hardware. I am developing from home and a student has the apparatus at their place. A lot of back and forth but let's say this one is done. Thank you