LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Multiple Events in Event Structure

Solved!
Go to solution

Hi all,

 

I was wondering if there was a way to combine user events with an AND operator to make one event. For example, I would like an event to happen when button1 AND button2 AND button3 have been pressed. Mabye event strucures arent the right way to do this, but right now when I add multiple events to one event frame, it seems to happen when any one of the events gets triggered, like event1 OR event2 OR event3 and I cant figure out how to change that.

 

Hopefully this makes sense what I want to do. I would nest my event structures, but I'm pretty sure that is bad and would give unexpected errors. Please advise.

 

Thanks!

 

0 Kudos
Message 1 of 6
(3,440 Views)
Solution
Accepted by topic author g_e_m_i_n_i

Use a shift register and maintain the states of which buttons have been pressed. Then you can actually execute whatever code you want once all of them have been pressed. If you do this you may need some type of timeout to clear the buttons to the unpressed state if only one or two have been pressed and nothing more some period of time.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
Message 2 of 6
(3,437 Views)

You cannot change all the buttons at once, but you can still use the OR nature of the event structure with multiple events for one case.

 

Create a case for the three buttons' Value Changed events. Inside the case read all three buttons. AND the result. Wire the AND to a case structure. In the True case activate the code you want for all the buttons.  In the False case do nothing.

 

Lynn

0 Kudos
Message 3 of 6
(3,436 Views)

@johnsold wrote:

You cannot change all the buttons at once, but you can still use the OR nature of the event structure with multiple events for one case.

 

Create a case for the three buttons' Value Changed events. Inside the case read all three buttons. AND the result. Wire the AND to a case structure. In the True case activate the code you want for all the buttons.  In the False case do nothing.

 

Lynn


You will need to pay attention to the mechanal action of the buttons. If they clear when read this will not work.



Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 6
(3,432 Views)

I assumed that if the requirement is for all buttons to be pressed that meant simultaneously on which would preclude latched action.  Of course the original post was not completely clear.

 

Lynn

0 Kudos
Message 5 of 6
(3,424 Views)

Mark,

Ahh yes that shift register works well. Thank you. 

 

John,

Thanks also, but my buttons werent latched actually (so yours would have worked :P), and yes I could have been more clear in my initial description. 

 

0 Kudos
Message 6 of 6
(3,377 Views)