10-21-2013 06:09 AM
Hi,
I have one while loop and another timed loop running parallelly. there is a button control in the timed loop whose status is being copied into an LED. Issue is, when the while loop is on, the button press event is not being registered in the timed loop. only when the while loop exits, i am able to press the button again. Attaching the vi.
Basically I need to detect the button press irrespective of the status of the while loop execution. and it shouid be possible as per the principles of parallel execution. why is it not happening? how can I do this?
Solved! Go to Solution.
10-21-2013 07:10 AM
While loop will give output only when it stops hence better get rid of it.
10-21-2013 07:26 AM
Hi
If you edit your event structures and deselect the Lock panel until the case for this event completes, this will help your application and allow the front panel thread to continue. I would also add an event for the stop button so that you can stop the bottom loop without hitting another button.
Final point, it is best practice to put the terminal inside the case of the event structure that refers to it.
Mike
10-21-2013 07:41 AM - edited 10-21-2013 07:42 AM
C:\Program Files\National Instruments\LabVIEW 2011\examples\general\controls\booleans\Mechanical Action of Booleans.vi
Take his reference
In my PC. dont know you labview version. there will be an example
10-21-2013 08:06 AM
its a bad way to program
1. you have not read about Timed Loop. you have given period of 200ms so it will iterate every 200ms. no need to put 100ms wait inside.
2. you don't ever need to put wait in a while loop that is containing event structure becuse if you wire Timeout > -1 , the while loop containing event structure will always iterate after Timeout value. And if you Don't wire timeout ( default, -1 ) the while loop will not iterate at all it will wait unless corresponding registerd event occurs.
3. Don't put while loop inside the event structure. When inside while loop will be iterating you will not able to do anything because front panel is locked.( you can make Unlock front panel also but that is not recommended, try to find out why?)
4. you should register a stop event for stop button.
Basically LabVIEW Help is quit rich so before using any function you should refer Help for it.
10-21-2013 08:30 AM
Thank you!
this loop is meant to run forever. thats why there is a constant wired to the stop terminal. Thanks for the other guidelines 🙂