06-12-2019 01:35 PM
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.
06-12-2019 01:51 PM
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!
06-12-2019 03:04 PM
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.
06-12-2019 03:06 PM
@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.
Please define the problem better?
06-12-2019 03:08 PM
@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. 😉
06-13-2019 11:06 AM
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
06-13-2019 11:18 AM - edited 06-13-2019 11:23 AM
@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.
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 😉
06-13-2019 12:15 PM
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
06-13-2019 12:20 PM
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 ;).)
06-14-2019 01:54 AM
@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.