LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Front Panel Freezes after start of routine

Solved!
Go to solution

Hi,

 

I am currently writing an application that looks a bit like the one attached. The idea is to have a configuration mode after the start of the program where you can enter all the data to specify a test routine. In the first loop representing the configuration mode I have an event structure that is quite huge actually, because it represents a context help for my program I added. After I hit the start button (which is only possible when certain tabs of the tab control are selected) I disable and gray the start button. After that the routine starts, there are several automatic modes and one for manual control that are selected according to the tab active.

 

In this mode the front panel suddenly freezes i.e. no control will react to my input.

 

I programmed this example program to get to cause of the problem. It appeared, that there was a problem when using local variables and the switch until released action. The problem was solved when I selected the switch when pressed mode.

 

I applied the same changes to the VI I am developing, but the problem still remained.

 

Anyone got an idea, why?



Remember Cunningham's Law
0 Kudos
Message 1 of 13
(4,689 Views)

Hello,

 

Problem is that the event structure locks front panel until event is processed. And when you had switch until released action - it procudes 2 events - first that the start button went from False to True, and one that went from True to False. And because you exit event structure after the first event, the second event was not processed and it locked the whole front panel.

 

To remove locking the front panel you need to go to the event of a start button, then right-click on the event structure, choose Edit Events Handled by This Case, and at the bottom disable Lock Front Panel option. This will the front panel won't freeze anymore.

 

Please inform me if this solution will work for you.

 

Best Regards,

Gregor Cerne

 

National Instruments

0 Kudos
Message 2 of 13
(4,679 Views)

As I mentioned before, I changed all the buttons to switch when pressed. So there's only one event, when I push the button.

 

I unchecked the option as you explained, but it didn't help.



Remember Cunningham's Law
0 Kudos
Message 3 of 13
(4,669 Views)

Hello,

 

But the example is now working corrent, right?

Try to change all the event cases so there will be no events which could lock the front panel - just in case if one of the event cases is blocking the front panel.

 

Best Regards,

Gregor Cerne

 

National Instruments

Message 4 of 13
(4,658 Views)

The example works as I posted it. As I said, for the example VI, changing the mechanical action to switch when pressed did the trick.

 

I already unchecked the front panel lock checkbox for all event cases. The event etructure finishes, and the routine starts and even runs normally. But as I said: It won't react to any actions on the front panel. 



Remember Cunningham's Law
0 Kudos
Message 5 of 13
(4,654 Views)

Hello,

 

If the event structure is finished, events that happen after finishing are no longer processed. That means you need to leave event structue running the whole program in pararel.

 

Please take a look at Producer/Consumer Design Patern (events) in the templates - this design patern is detecting events in upper loop (producer), and when the event is detected the data is send through queues to a lower loop (consumer), where the data is procesed. The data sent are usually name unique to the event (names can be custom), and in the consumer loop the is case structure which executes the code depending which event happened.

 

If you need further explanation about this desigh pattern or some help with implementation in your code, feel free to ask.

 

Best Regards,

Gregor Cerne

 

National Instruments

0 Kudos
Message 6 of 13
(4,647 Views)

But the rest of the Program isn't event driven...

It's the same as in the example I posted: first the configuration mode that ends with either pressing start or stop. then I have a loop that constantly polls the status of a control... In the example this works perfectly, without running the first loop in parallel. And at a certain point this worked, but as the project grew, an error snuck in somewhere. Now I'm trying to find it.



Remember Cunningham's Law
0 Kudos
Message 7 of 13
(4,639 Views)

Hello,

 

From amount of information about your program you gave me untill now I can not define your problem. If your VI is not confidential, I would ask if you can attach your VI here. If the VI is confidential, I would ask you to answer few questions in order me to understand your program:

What kind of front panel object are you using?

What event cases do you have?

Which are the actions on front panel that are not reacting when the event structure is finished?

 

 

Best Regards,

Gregor Cerne

 

National Instruments

0 Kudos
Message 8 of 13
(4,629 Views)

I found the problem:

 

In my configuration part of the program I have a huge event structure which has one event for each control on the front panel (Mouse enter), that writes a text to a string indicator and one event for all controls (Mouse leave), that writes an empty string to the same indicator. When I push the start button all this is supposed to end, but I suppose that in the brief moment between pushing the button and the program exiting the loop, the structure registers some of these Mouse Move events and therefore produces the error, because it cannot complete the task. I solved this problem by running these events in a parallel loop with a second event structure and letting it run throughout the program. This however isn't a clean solution I think, because the parallel loop costs CPU Power, when I need it. Is there any possibility of ending the loop neatly?



Remember Cunningham's Law
0 Kudos
Message 9 of 13
(4,613 Views)

Hello,

 

Pararell event structure does not costs a lot of CPU power (depends what code you have in the event structure), because it is only executed when the event is triggered, otherwise the event structure does not cost CPU. That is why I advised you to put only one event structure in pararell, because is does not impact the performance and still you recieve all the events that you need,

 

Best Regards,

Gregor Cerne

 

National Instruments

0 Kudos
Message 10 of 13
(4,572 Views)