LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

button status read issue during parallel loops execution

Solved!
Go to solution

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?

0 Kudos
Message 1 of 6
(2,881 Views)

While loop will give output only when it stops hence better get rid of it.

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 2 of 6
(2,867 Views)
Solution
Accepted by pcs82

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

Message 3 of 6
(2,865 Views)

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

--------------------------------------------------------------------------------------------------------
Kudos are always welcome if you got solution to some extent.

I need my difficulties because they are necessary to enjoy my success.
--Ranjeet
0 Kudos
Message 4 of 6
(2,860 Views)

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.

Message 5 of 6
(2,852 Views)

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 🙂

0 Kudos
Message 6 of 6
(2,842 Views)