LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

basic button problem

Solved!
Go to solution
I'm having problems with what I thought would be an easy task.  Basically, the front panel displays a choice of three buttons, and the user selects which task to complete.  The problem is that once I push one button, neither of the other two work.  It's like the program is getting stuck in the case structure that is implimented when the first button is pushed.  How do I get the vi to exit this case structure?  A picture of the vi is attached.  This is part of a larger vi, and this section is enclosed inside a while loop (not pictured).  I realize this is probably a very simple question, but I've now spent 2 days on it and have had no success.  Please help!!
0 Kudos
Message 1 of 10
(3,560 Views)

When you push the second button you call the same vi, which has not finished execution. So the program must wait to complete the first call to re-call it.

Solution : Make your sub-vi reentrant.

vi properties >> execution >> reentrant execution

0 Kudos
Message 2 of 10
(3,539 Views)
Does your "neslab chiller" subVI have a loop in it?  I don't think that your main while loop will iterate until the code inside the active case structure finishes its execution, so if there is loop in the "neslab chiller" subVI this may explain your problem. You also need to make it reentrant as mentioned above.

Message Edited by jmcbee on 12-18-2008 09:25 AM
0 Kudos
Message 3 of 10
(3,538 Views)

Hi McMurray,


Thanks for the post and I hope your well.

 

This is because your calling the VI Statically. Thus when the subVI is called - the code within is being excuted, and the calling VI waits until excution is complete within the subVI. What you need to do is to call the subVI dynamically which will then allow the main VI to continue it's execution while the subVI continues to run. 

 

This is done using VI Server.Please see image of code to use.


I hope this helps to get you started, 

 

Note, This is more useful if you have different subVIs to call. OR if your calling VIs across a network. 

 

Message Edited by Hillman on 12-18-2008 04:26 PM
Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Message 4 of 10
(3,535 Views)

If this is your main vi, the "neslab chiller" sub vi has to complete execution before it will return to the main vi. I'm assuming you have a while loop wrapped around the code you show in the .jpg as well?

 

So, this depends on the code inside the "neslab chiller" sub vi, but it will need to complete before the main vi will see another button press. 

 

Another issue - you will want to set the boolean back to false within each respective case structure, or else the code within the case structure will keep being exectuted and not see another button press.

 

 

0 Kudos
Message 5 of 10
(3,532 Views)
Solution
Accepted by topic author McMurray
Use 3 separate while loops. Also remember to include the function i have pictured in every loop. Set wait time as you want it to be


Besides which, my opinion is that Express VIs Carthage must be destroyed deleted
(Sorry no Labview "brag list" so far)
0 Kudos
Message 6 of 10
(3,526 Views)

As far as the VI Server goes, where should it be located within my program?  For example, should I include this inside of the main, overarching while loop that my program is running in, or should it be included inside of the smaller sub-loops?  In other words, will creating one VI Server suffice for the entire vi, or will I need to have multiple servers running, one for each while loop calling the sub-vi?

 

Thanks for all the great thoughts!

0 Kudos
Message 7 of 10
(3,478 Views)
Also, once I've created my VI server, I obviously need to change how I call the Neslab Chiller vi.  How should this be done?  Thanks for your patience.
0 Kudos
Message 8 of 10
(3,474 Views)

Hi,

 

I Suggest you to use events structure, instead of case structure.

 

and the way u r calling the VI is statis and it does not allow any other part of the program to run until it finishes the execution.

 

You use dynamic VI for calling your Sub VI. and If the property of the Window appearance for ur sub VI is, MODAL, then change to to float.

 

This would allow you to launch all sub VIs in parallel.

 

and make your VI Re-entrant as mentioned in this thread earlier.

 

 

Anil

Anil Punnam
CLD
LV 2012, TestStand 4.2..........
0 Kudos
Message 9 of 10
(3,461 Views)

Hi McMurry,

 

Thanks for the update.

 

You only have one VI Server - this is one of many things LabVIEW 'sits' upon.


However, in terms of the API you can use it as much as you like. Obviously, you should only exucute the code when required - otherwise you'll call subVIs on every iteration, which  if required the you may as well leave the subVI running in parallel with your main VI. Also, you would have to be careful you don't call the same VI twice (while one is open). 

 

For more info on VI Server please see the following links:

 

Capabilities of the VI Server

http://zone.ni.com/reference/en-XX/help/371361E-01/lvconcepts/capabilities_of_the_vi_server/

Including, Call a VI remotely & Dynamically load VIs into memory

 

Building VI Server Applications

 http://zone.ni.com/reference/en-XX/help/371361E-01/lvconcepts/building_vi_server_applications/

For help file info. Explain the API.

 

Example Finder

Search VI Server

VI Server.lvproj - shows the host calling aspect. 

 

My example of dynamically calling:

LabVIEW 8.6.

 

Hope this helps, 

 

 

Kind Regards
James Hillman
Applications Engineer 2008 to 2009 National Instruments UK & Ireland
Loughborough University UK - 2006 to 2011
Remember Kudos those who help! 😉
Download All
0 Kudos
Message 10 of 10
(3,417 Views)