05-19-2012 05:16 AM
Hi guys
Is there any way to find how many times a numeric control switch has been pressed(either increment or decrement)???
thanks in advance
Solved! Go to Solution.
05-19-2012 06:31 AM
Use an event structure. You could use the Value Change event, but that would be triggered even if the user clicked inside the control and typed a new value. Alternatively, you could use the Mouse Down event. In this case you'd need to compare the current value with the previous value (shift register or feedback node) to tell you if the value changed, since the value will be changed before the event is fired.
Please review the LabVIEW Help and the LabVIEW examples on shift registers and event structures.
05-20-2012 12:46 AM
Hi Newbee_2,
This is a sample VI.You can make this to the form you wish.In this it will count number of times one will click "pick" button.
05-20-2012 02:11 AM
05-20-2012 07:11 PM
I wouldn't necessarily call it a bad example. I can accomplish the goal of counting button clicks. However, it might belong in the Rube Goldberg thread.
05-20-2012 08:01 PM
@crossrulz wrote:
I wouldn't necessarily call it a bad example. I can accomplish the goal of counting button clicks. However, it might belong in the Rube Goldberg thread.
Yes, except for the fact that the OP asked to count the number of times a numeric control's value was changed via the increment/decrement, and not how many times a button was pressed.
05-21-2012 02:36 AM
Thanks everyone for their valuable input but I just want to create a vi that makes a decision when value of numeric control changed for the first time and different decision for subsequent changes in numeric control. I am attaching that VI which is working but I want make it better because here you have enter the value before starting of the VI otherwise it will not work...
05-21-2012 07:50 AM
@Newbee_2 wrote:
Thanks everyone for their valuable input but I just want to create a vi that makes a decision when value of numeric control changed for the first time and different decision for subsequent changes in numeric control.
That is a completely different requirement. It would help if you stated what you actually want from the start.
As for your VI: it has numerous problems.
Based on what I am seeing, it seems to me that your statement that you just want to create VI that makes a decision if a control changes value the first time vs subsequent changes if just the tip of the iceberg. And while the solution to this problem is quite simple, rather than giving you a band-aid, it would be better if you explained what you are actually trying to do with your code, so better suggestions can be provided.
05-21-2012 11:07 PM
Sorry but I am bit fond of local variable and inner conscious drive me toward using local variable. Actually the operation is like when you first time enter the value through numeric control it should check the default value of the IC(5K, AD529x) but after it has checked the value for the first time and ether incremented(or decremented) it will check with current value rather than default value and will do necessary operation(making Porto high/low than no of pulses through port1 to go the that particular value ) and this a testing code which will used to test the operation of circuit which has that IC AD529x
05-22-2012 07:30 AM
@Newbee_2 wrote:
Sorry but I am bit fond of local variable and inner conscious drive me toward using local variable.