LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Stop inside of running tab control doesn't stop!

Hello all. I seem to be having some sort of logic issue here and maybe someone can help me out.

 

To keep this brief I'm taking in three readings off of the DAQ and displaying them on waveform graphs that are inside of a nested tab control. The acquisitions are being run inside of a while loop. While this is running I cannot change tabs, or even click the stop button to leave the while loop. I have already tried putting in a wait 1ms and it doesn't work either.

 

I know this has to be something simple, just been scratching my head on this one for a little bit.

0 Kudos
Message 1 of 9
(4,172 Views)

You posted a vi that is password protected....

 

What is the need to post your VI protected by password... No body will ask you the password and open the VI and solve your problem... Or make a reply to tell you to unlock the VI and post.. they will just simply leave your problem and go for the others... Understand the use of Discussion Forum..

 

Smiley Mad

-----

The best solution is the one you find it by yourself
0 Kudos
Message 2 of 9
(4,158 Views)

Oh shoot! Sorry about that! I forgot to unprotect it. Totally spaced on that. 😞

 

Here's the unprotected one.

0 Kudos
Message 3 of 9
(4,153 Views)

Hello,

 

There are several "tab" in your VI  (3), but just one is in the while loop. Try to put all the "TAB" in the while loop so that their changes can be made.
If this does not solve the problem try using the debug tools (breakpoint, lamp ...),

 

Best regards, 

 


0 Kudos
Message 4 of 9
(4,145 Views)

Hello,

 

Just one last thing,  the large while loop has no stop button. So your application will not stop! Try to connect a button stop in it, and also you can create an event on the changing data of this button to stop the application...

 

I 'am attaching an exemple


 

Best regards,

0 Kudos
Message 5 of 9
(4,138 Views)

Hi testy,

Using nested Tab Control is not a big deal, but handling is very important. It your code, so many logical error is there,In true and false cases, each case have one stop button and event structure. So when you press start event the program not sure that where to jump. And even though it is in "True case"  event handler will queue it up in the false case and try to execuit when it is turn... So it wont allow you to press stop.

One more thing, in your program it is not sure that which event handler wil work first. So the tab control will automatically open one particular event which got the access first, and it won't allow you to go to next tab because event not handled properly.

 

Suggestion:

1. Make local variable for stop

2. Use one good architecture to handle both the events

3. If you use event structure use only one for whole code.

 

<<Kudos are welcom>>

0 Kudos
Message 6 of 9
(4,132 Views)

Sorry for the time between the reply - I've hooked the stop from the inside of the nested while loop and placed hooked it up via tunneling.. pretty much all different ways I can think. Problem is, when the sampling is going on it just seems that I am not able to click on any of the tabs or any of the buttons. Is there some way that I can click on things while it is sampling?

0 Kudos
Message 7 of 9
(4,069 Views)

Your stop terminal is inside an event case that is configured to lock the front panel until the event completes. (all your events seem to be configured like that).

 

This means while the event is executing, the front panel does not accept user interactions. This is bad, because your code is trapped inside a while loop inside the event and thus cannot be stopped.

 

Quick and dirty solution: configure all your event to NOT lock the front panel. (This will not be sufficient, because of other problems described below!)

Longterm solution: Re-architect your code so you don't have loops inside events.

 

Your code is a real mess, for example you have multiple parallel event structures inside the same loop. That's a big no-no. The loop can only finish if both events fire, leading to deadlocks and unpredictable behavior. Never use more than on event structure per loop and don't put loops inside event structures. Never place event structures inside case structures (You have different event structures in different cases of the same case structure!!!). An event structure always must be in the data path, ready to react. it queues up event even if it cannot handle them due to dataflow problems.

 

All you need is one main outer loop and ONE event structure. Try it!

0 Kudos
Message 8 of 9
(4,053 Views)

Okay, so let me clarify. I should place a while loop around the entire code that has a main stop button and then an event structure in the middle of it? One of the problems that would have though wouldn't it only take one sample before leaving the event?

 

I'll give it a try, going to have to re-write the code. I know it's a mess because I'm not the most proficient at labview (As you could tell) so I just kind of hooked things together till they kind of worked. 😕 I'll post up the VI after a massive re-write. Thanks so much for the advice.

0 Kudos
Message 9 of 9
(4,046 Views)