LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Programmatically stopping events

Dear members,
 
I was conteniously asking to myself how i can immediately stop an event structure. The problem is when you have some sub vi's in a particular event case.
Then you should also stop immediately the sub vi into the event case to reduce the "stop speed"
I would be very helpfull to give me some advice, thank you
 
I my example, i have insert a stop button into event case, but when i press deluxe wash, i should wait before the end of my sub vi to stop the event structure. 
 
Jeroen
Download All
0 Kudos
Message 1 of 6
(3,511 Views)
I cannot look at your VIs right now but generally no code should execute inside an event case if that code might take longer to execute than the minimum interval between events. I usually use about 10 - 50 ms as a maximum time inside an event case.

The alternative is to have a parallel loop which does the time consuming processing. Pass data or commands from the event case via a queue or Action Engine.

Lynn
0 Kudos
Message 2 of 6
(3,505 Views)

You should pass the STOP button condition in the sub vi , somehow.

With a reference , a global variable, or a user event, a notifier..... That, will be monitoring in the sub vi , and stop it when it is needed

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

Thank you for the advice.

I have another question about event structures. When you add an event structure , you can select multiple event sources to trigger with a specified event.
The logical operation between both is an OF operation. When you press one of them, the event case is handeld.
I want to do an AND operation between both, when you press one of them, the event isn't handeld, because he is waiting on the next one to handeld the case

Thanks,

jeroen

 

0 Kudos
Message 4 of 6
(3,458 Views)
Hi jeroen,

events are handled as soon as they occure, so the event structure will always operate in OR mode.

You can do:
When first event occurs you set a boolean (shift register) to true. When the second event occurs you first test this boolean and if false you don't process the second event (use a case structure inside the event case).
Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(3,446 Views)
jeroen,

GerdW has suggested a good approach. In addition to what he proposed you may need to consider when to reset the boolean to False. Do the two events need to occur within some time limit of each other? Is the first one "cancelled" if some other event (not the ANDed second event) occurs between the two events? If you do not do this, the first event could occur now and the second one next week and the specified action would then happen. If that is what is required, no reset is necessary.

You will want to reset the boolean after the ANDed events have occurred to be ready for the next time.

Lynn
0 Kudos
Message 6 of 6
(3,429 Views)