LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to handle event structures for two buttons and two counters.

     *I have two buttons A and B, and have to compare the difference in hits between them.  So do I place an event structure within a while loop for each button (2 buttons, 2 event structures, 2 while loops), or does it need to be one event structure with cases for both buttons whithin one while loop? 
     *How do I pass the values of buttons A and B's hit counters out of the while loop in order to calculate the differences between them after each increment, not just the final count after the stop button is hit? 
     *How would I make one stop button work to handle both buttons A and B?   I tried to place the actual stop button in one button A's structure and its global in B's structure, but It wont seem to let me use a local variable for a latchable control
 
Checker
0 Kudos
Message 1 of 3
(2,634 Views)
I guess you'd want to use a single event loop with shift registers for the hit counters.

You could either handle presses for A and B in separate cases or in the same case.

The stop button should have it's own case in the event loop.

Adam

0 Kudos
Message 2 of 3
(2,627 Views)
You should probably have not started a new thread and waited until your question in the original thread was answered. You can modify altenbach's example for a second button. You have a single event structure with a new event for the second button. You have a second shift register to track the number of times the second button is pressed. Inside the while loop but outside the event structure, you just have a subtract function in or to report the difference. do not modify the posted example for the stop button. It works perfectly as is.
0 Kudos
Message 3 of 3
(2,623 Views)