LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem with Booleans and events

I have an event structure inside a while loop. I have several buttons each of which triggers one event. Now no matter what latch action I try with these at any point of time only one of the events run. So if I want to run another event I have to stop the main vi run it again and then go to the next event. I guess what this means is that the events are not being terminated by value change. But I have tried to reset the value of the boolean as well in order to terminate but event this doesnt seem to work.There is some fundamental problem somewhere but I am unable to figure it out. Can somebody please help me.

I am attaching a sample vi and sub vis that demonstrate this problem. In this case I need to have the booleans h
ave the switch when released action. i.e as long as the button is pressed the camera i control moves left and as soon as I release it it shud stop.
Download All
0 Kudos
Message 1 of 3
(2,703 Views)
You need to decide whether you want things controlled by events, or by loop polling.

Some things to consider:

Inside each event you have a loop where you read the booleans the events react to. That means the events will be fired over and over again inside the loop, and you'll have a stack of old events to be fired when the while loop has exited...events you don't really want to do anything about (use events for all the button clicks, or loops - not a mix).

Events are still flow controlled so when the left event fires and it enters the while loop it won't handle any other events until that while loop has finished.

When an event fires the button value if read at the same time is not the value the event fired on. So when you have an event that fires when
you press the button, if you wire the button value to something inside that even it won't be true, it will be false. Use the new value output of the event case to read the value you really want.
0 Kudos
Message 2 of 3
(2,703 Views)
Hi!

Thanks a lot! I am new to the event structure and confused because of that. Thanks for ur help!

Hema
0 Kudos
Message 3 of 3
(2,703 Views)