LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop dead loop in event structure

Hi all, I am using event structure to respond to GUI action. Some cases will lead to very complex event process routine, and sometimes the routine will be in dead loop. I put a STOP button on the front panel. In case of dead loop, I want to use stop button to stop whole program. The problem is STOP is also handled by event structure. So since the dead loop has occupied the event handling, it will not respond the new event of STOP. Is there a method to overcome it?
0 Kudos
Message 1 of 5
(2,995 Views)

An event structure should only handle code directly that can complete quickly so it is ready for the next events. You need to run your lenghty code in a parallel loop, for example. Look into e.g. a queued state machine.

 

Also, by default, events are configured to lock the front panel until the event completes. If you want the UI to remain responsive while there is an ongoing event, you need to un-check that.

 

Feel free to show us your code so we might have more specific advice.

Message 2 of 5
(2,985 Views)
Thanks Altenbach. I have sent a Kudos but I never did it so I don't know if it is well done. In brief I am doing a test program which comprises many test items. I assign every item a button. Clicking on it will pop up a window and run correspondant test. Unfortunately some test will be in dead loop. This is what I am facing. State machine is heavily used in my program but I never used queue state machine. It is the time for me to learn something deeper. I am just programming in a style that never look up more unless I need it.
0 Kudos
Message 3 of 5
(2,978 Views)
Before I use more advanced method like QSM, I am wondering if I can set up 2 event structures in parallel? One is dedicated for the START, STOP, and LAMP such kind of simple things, while the other one is dedicated for the long running items.
0 Kudos
Message 4 of 5
(2,971 Views)

Hi steady,

 

please read the context help for the event structure, it's quite extensive!

 

There you could read: it's not recommended to have more than one event structure in parallel... And still it isn't recommended to have long-running event handling routines (as Altenbach already said).

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 5
(2,953 Views)