LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Boolean to increment a counter

Solved!
Go to solution

I want a VI that would increment a counter every time a boolean gives a true value. In other words, every time a switch is pressed, the counter should increment to the next whole number and so on.

0 Kudos
Message 1 of 15
(6,153 Views)
This should be a pretty trivial exercise. Have you taken any of the free tutorials. Do you know what a shift register is or an event structure. No one here is going to do your homework for you do please attach whatever you have written so far so you can get some help.
0 Kudos
Message 2 of 15
(6,136 Views)

I am new to LabVIEW and just have a basic knowledge of it. Although i'm aware of shift register, im not accustomed to event structure... im enclosing a rough idea i made to vi..

0 Kudos
Message 3 of 15
(6,130 Views)
Can you attach an image of the block diagram? I'm posting by phone.
0 Kudos
Message 4 of 15
(6,127 Views)

i dont think this works, let me look up event structure

0 Kudos
Message 5 of 15
(6,123 Views)
You've got everything backwards. The whole loop should be the outer most structure with the case structure inside that. The event structure is a more elegant solution though.
0 Kudos
Message 6 of 15
(6,107 Views)
Solution
Accepted by topic author karthiksudhir80

 set mechanical action of your button to switch until release, if you want yor increment is every click is increment by 1

 

 

counter boolean.png

 



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 7 of 15
(6,105 Views)

i liked the idea of event structure, implemented it with some local variables .. it works fine

0 Kudos
Message 8 of 15
(6,087 Views)
Solution
Accepted by topic author karthiksudhir80

thanks for your support, i used event structure and local variables and implemented this application which increments the counter when swittch 1 is pressed and decrements the counter when switch 2 is pressed, and glows a light when the value of the counter is greater than 0.

0 Kudos
Message 9 of 15
(6,082 Views)
No. Do not use local variables. Use a shift register and have another event for the stop button.
0 Kudos
Message 10 of 15
(6,073 Views)