LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

call a button

hi,

 

I have two buttons in a vi called as start and stop.

 

In start button, i have written code. so i want to call this code in stop button.

 

how can i do this in labview?

 

InAdvance Thanks

 

Regards

Soundarya

0 Kudos
Message 1 of 12
(3,591 Views)
First what version of Labview do you have? I don't really understand your question. As I understand it you want to exicute code when the start button is pressed and different code when the stop button is pressed?
Tim
GHSP
0 Kudos
Message 2 of 12
(3,583 Views)
If you could post your code that would also help.
Tim
GHSP
0 Kudos
Message 3 of 12
(3,579 Views)

Hi Soundarya,

if you want to run the same code if you press the stop button, then you can use a property node of the start. Use the value(signaling) property to trigger the code from the start button.

 

Hope it helps.

Mike

0 Kudos
Message 4 of 12
(3,575 Views)
You could also use an event structure and have both events registered to the same code. That is why I asked what version of LabVIEW you are using so I can help with the easiest solution. I can tell you about ten different ways to code this but it will depend on the version of LabVIEW and what you are ultimately trying to accomplish.
Tim
GHSP
0 Kudos
Message 5 of 12
(3,570 Views)

Soundarya wrote:

I have two buttons in a vi called as start and stop.

In start button, i have written code. so i want to call this code in stop button.


Buttons don't have code (unless you have an xcontrol).

 

Please clarify what you are trying to do, preferably with an example.

 

(If the same code should run in the start and the stop case, it simply belongs outside the case structure.)

0 Kudos
Message 6 of 12
(3,533 Views)
have you tried an event structure or a state machine
Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
0 Kudos
Message 7 of 12
(3,515 Views)

I have used value(signalling) property. How should it get connected?

 

Thanks in Advance

 

Regards

Soundarya

0 Kudos
Message 8 of 12
(3,487 Views)
labview 8.6
0 Kudos
Message 9 of 12
(3,486 Views)

Soundarya wrote:

hi,

 

I have two buttons in a vi called as start and stop.

 

In start button, i have written code. so i want to call this code in stop button.


I assume that you have code inside a Case Structure connected to Start button.

 

If you want to call this code in Stop button also, just make it as a SubVI by selecting the piece of code inside the CS & using the menu option Edit >> Create SubVI... thats it. Smiley Happy

 

But it is highly illogical & totally meaningless to have/call the same code in both the Start & Stop buttons, as their names suggest what is their respective purpose.

- Partha ( CLD until Oct 2027 🙂 )
0 Kudos
Message 10 of 12
(3,481 Views)