ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Sub-VI Close

Hey,

 

In my set-up, i need a log-in facility that pops up a sub-vi if successful.

 

I modified the Login Dialog that comes with LabView examples, and it works fine by poping up the dialog box.

I made a very simple sample sub VI which just displays a string and a stop button. 

 

I expected the sub VI to close after I click the stop button, but there is quite a delay, and sometimes i need to press the stop button twice.

 

Just wondering is there an easy setup change that will close the sub VI immediately once i hit stop. I need the main VI to continue running then.

 

Any help would be appreciated. 

I've attached the VI's

 

Rkll

Download All
0 Kudos
Message 1 of 7
(3,632 Views)
You should change the mechanical action of your booleans to Latch When Released and the while loop in the subVI needs a Wait (ms) function to avoid hogging the cpu.
Message 2 of 7
(3,625 Views)

You should change the mechanical action of your booleans to Latch When Released and the while loop in the subVI needs a Wait (ms) function to avoid hogging the cpu.

 

p.s. that bit of code with the Select functions is silly. Just wire directly to the case statement.

Message 3 of 7
(3,624 Views)

Tanx for the swift response, I works with the sample sub-VI.

 

However when i tried the actual VI, i get the same problem. I think its because in the actual subVI, i have the while loop stop triggered by a value change event on a stop button. 

Is this a problem because of the Mechanical action of the Stop button? Or the event structure?

 

0 Kudos
Message 4 of 7
(3,608 Views)

I'm confused. What 'actual VI'? Are you saying that you are running different code than what you posted? Aside from the confusion of asking for a fix of code that you did not post, the only problem with the subVI you posted was you did not have a wait in the loop. If you have an event structure, you don't need a wait.

 

The incorrect mechanical action is in your top level VI that you posted. Is that different than the 'actual code' as well?

Message 5 of 7
(3,602 Views)

Ok, Im sorry for the confusion.

 

You see, I developed this VI to basically edit arrays. Its called recipeeditor.vi.

Then i needed the login to pop up this recipeeditor if the password was right, so i started developing the login. I used a really quick vi that i made up, just to be extra cautious because i didn't want anything to happen to the other VI. So when you gave me the fix for the other VI, i assumed it would be the same for when i inserted the recipeeditor sub VI.

 

I hope i'v cleared things up.

 

I've attached my files again.

Download All
0 Kudos
Message 6 of 7
(3,589 Views)
There are now numerous missing subVIs but when I deleted the code required from them and changed all of the mechanical actions to Latch When Released in the main and Recipe Editor, everything works like I would expect.
Message 7 of 7
(3,587 Views)