Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Measuring speed

Solved!
Go to solution

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

0 Kudos
Message 1 of 8
(3,262 Views)

Or would this be the proper way to measure time of a rotation?

0 Kudos
Message 2 of 8
(3,241 Views)

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

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 3 of 8
(3,223 Views)

Thank you!

 

This should be a V.16

0 Kudos
Message 4 of 8
(3,195 Views)

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

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 5 of 8
(3,184 Views)

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?

 

0 Kudos
Message 6 of 8
(3,128 Views)
Solution
Accepted by topic author Murph

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

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 7 of 8
(3,124 Views)

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

0 Kudos
Message 8 of 8
(3,109 Views)