From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Count the number of revolutions a knob makes

New to Labview. I have been looking to create a program that counts the number of times the knob passes zero.  Just needs to be simple.  I can't seem to figure it out.

0 Kudos
Message 1 of 11
(2,919 Views)

Hi Creepy,

 

counts the number of times the knob passes zero.

Translation of the problem:

When does the "knob pass zero"? Answer: when the sign of the knob value changes…

 

You need:

- a shift register to hold the previous knob value (or sign)

- a comparison of previous sign with current one

- when the result is "has changed" you need to increment a value, stored in a 2nd shift register

 

So how far you get!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 11
(2,912 Views)

Does your knob count up to a maximum value then restart at zero if you keep "turning it clockwise" and count down to zero and reset to maximum value when "turning it counterclockwise"?

 

Seems to me you just need to count the number of times the knob=zero.

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 3 of 11
(2,890 Views)

@Creepy wrote:

New to Labview. I have been looking to create a program that counts the number of times the knob passes zero.  Just needs to be simple.


The question is not well defined, because we don't know where zero is (are there positive and negative position or is it e.g. 0..10). Do you need to distiguish the direction of passing through zero? What should happen if it goes to zero but then reverses rotation?

 

Just counting revolutions can be done using "unwrap phase ptbypt" as follows, but it is not clear if this is what you want.

 

unwrapper.png

 

Please define the problem better?

 

0 Kudos
Message 4 of 11
(2,887 Views)

@RTSLVU wrote:

Seems to me you just need to count the number of times the knob=zero.


That would only work for integers. we don't even know the datatype yet. 😉

0 Kudos
Message 5 of 11
(2,883 Views)

I don't think I know how to make a multi-turn Knob control!  I tried doing this with an Integer Control, but if it counts 1 through 10, it stops at 1 and 10 (I didn't spend a lot of time poking around with this, thought it was prudent to ask for help ...).

 

Bob Schor

0 Kudos
Message 6 of 11
(2,836 Views)

@Bob_Schor wrote:

I don't think I know how to make a multi-turn Knob control!


Also don't forget this option (checked by default), although it seems to be ignored if the scale covers the full 360 degrees.

 

lockknob.png

 

Also note that the subject and question contradict: count revolutions is not # of zero passes. You can pass zero an infinite number of times without ever doing a full revolution. 😉

 

There are also these old discussions that can easily be found 😉

0 Kudos
Message 7 of 11
(2,832 Views)

Hmm -- I'll try again, but I did see the "Lock" entry and though I unchecked it (but I may have had an 11-value Knob, 0 .. 10, with 0 and 10 overlapping, silly me).  Ah, with a Knob with 10 values, it (as perhaps should have been expected) will do multi-turn fine with Lock Needle turned off.  However, its value is still restricted to 1 .. 10 (despite trying to mitigate it by Data Entry Limits), forcing the Implementer to recognize multi-turn values.  [Note -- I tested this with LabVIEW 2018 and an I32 Knob].

 

Bob Schor

0 Kudos
Message 8 of 11
(2,816 Views)

Yes, counting turns needs to be done in software, e.g. as in my ptbypt solution above or in the linked discussion.

 

(I won't mention xcontrols ... Oops, I just did ;).)

0 Kudos
Message 9 of 11
(2,814 Views)

@Bob_Schor wrote:

Hmm -- I'll try again, but I did see the "Lock" entry and though I unchecked it (but I may have had an 11-value Knob, 0 .. 10, with 0 and 10 overlapping, silly me).  Ah, with a Knob with 10 values, it (as perhaps should have been expected) will do multi-turn fine with Lock Needle turned off.  However, its value is still restricted to 1 .. 10 (despite trying to mitigate it by Data Entry Limits), forcing the Implementer to recognize multi-turn values.  [Note -- I tested this with LabVIEW 2018 and an I32 Knob].

 

Bob Schor


You need to be able to turn it up to 11 Bob, its one louder.

https://www.youtube.com/watch?v=4xgx4k83zzc

0 Kudos
Message 10 of 11
(2,789 Views)