LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Problem in Labview

Hello,

 

I am a French student in England, i am making an internship.

 

My objective is to develop a program in Labview but I have got problem, I do not know how to call a SubVI when I push a button in principal program, I would like have just 4 buttons in my principal program which allow call 4 subVI. I would be happy to receive any ideas or propositions in order to develop my reflections on this issue. 

 

Thank you very much

0 Kudos
Message 1 of 10
(2,791 Views)

Hello Meratus,

The easiest way to perform this task is use four boolean buttons on the front panel.

Use the outputs of all buttons to build a boolean array.

convert the boolean array into number.

Then use the number to select the respective subVI from a case structure.

The whole code should be inside the while loop.

 

157+ CLDs & 9 CLA Trained
LabVIEW Training resources
0 Kudos
Message 2 of 10
(2,783 Views)

Hey,

 

Simplest way: just place your subVI in an eventstructure (event on the button you want to use to start the subvi) and show the frontpanel of the VI. (VI properties -> show frontpanel)

 

Alternativ: check out the palette Application Control VIs and Functions. Detailed informatin here

 

Regards,

CMW..

0 Kudos
Message 3 of 10
(2,775 Views)

Thank you very much for your answer,

 

But I do not know how I can build a boolean array, convert the boolean array into number.

How use the number to select the respective subVI from a case structure ?

My whole code is inside the while loop so it is okay for this part.

 

Kind regards

0 Kudos
Message 4 of 10
(2,771 Views)

In case you want to follow the way with the case and the boolean array -> Build Array -> convert to number

 

btw. both functions are explained in the LV Help and can easily be found by searching

 

Regards,

CMW

0 Kudos
Message 5 of 10
(2,754 Views)

This might the simplest way for you. No need to create arrays, or numbers. Just use four button (boolean type) controls, and poll each one in a while loop. When you press one of the buttons its case structure will run the True case, and it's in there that you will want to place your individual subVIs.

 

The fifth "stop" button is necessary to allow the while loop to be stopped cleanly.

 

simple4buttonVI.png

Thoric (CLA, CLED, CTD and LabVIEW Champion)


Message 6 of 10
(2,748 Views)

Solution from Thoric is perfect.

157+ CLDs & 9 CLA Trained
LabVIEW Training resources
0 Kudos
Message 7 of 10
(2,722 Views)

Thank you very much,

 

But i would like to open just the programm when i push the button, here all my programm are closed when i push the button. Moreover i would like control just one programm when i push the button, not all !

 

Thank you very much for your answers

0 Kudos
Message 8 of 10
(2,711 Views)

Just to complete all possiblities,

attached with eventstructure....

0 Kudos
Message 9 of 10
(2,709 Views)

@Meratus wrote:

Thank you very much,

 

But i would like to open just the programm when i push the button, here all my programm are closed when i push the button. Moreover i would like control just one programm when i push the button, not all !

 

Thank you very much for your answers


This doesn't make sense to me. If you place your VIs into the case structures, one per case structure and not all into one case structure, then each button press will launch the VI in it's attached case structure.

 

I don't understand why you would see your VIs close? Note that it may be that you need to set a property of your VIs to "Show Front Panel when Called". This can be found in the VI properties under Window Appearance > Customise. This ensures your VIs open up their front panels when called from the main VI (the one with the four buttons).

Thoric (CLA, CLED, CTD and LabVIEW Champion)


0 Kudos
Message 10 of 10
(2,692 Views)