LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How does a VI detect itself is running?

I want to set a 'Exit' button on the VI front panel so that when the VI is running, it shows a different text from the text after the VI quit.

 

Thanks,

 

Ryan

0 Kudos
Message 1 of 11
(4,288 Views)

you can use an event structure for an exit button

 

and my question is are you sending text into a string indicator or are you wanting to change the test of the exit button?

 

if it is a string indecator just send a constant string into the indicator under the exit event.

 

if it is the exit button label you will have to use a property node.

Harold Timmis
htimmis@fit.edu
Orlando,Fl
*Kudos always welcome:)
Message 2 of 11
(4,287 Views)

Harold,

 

I will use the property node. I am using a LabVIEW base version, which does not have event structure function. Do you have other method?

 

I can differentiate the 'exit' status. Just before exit the program, I set the property node to 'quited'. But How do I differentiate between the open in edit mode and running.

 

Ryan

 

0 Kudos
Message 3 of 11
(4,281 Views)
The event structure is available in all versions LabVIEW. It is part of the core functionality. Unless you are talking about very old versions before LV 6.0.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 4 of 11
(4,274 Views)

Hi Mark,

 

the event structure is not available in the base versions. It will be "visible" when code was generated in a "better" version, but will not be editable...

(See context help: "Installed with: Full Development System")

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
Message 5 of 11
(4,271 Views)

I think the solution can be as simple as this. You don't really need to do anything fancy to "detect" if a VI is running or not. On the VI block diagram, have the first thing you do be to call the property node to set the Button text to the run-mode text, and have the last thing you do be to set the Button text back to the offline text. Simple as that.

 

Use Error Cluster wires or Sequence Structures or any other dataflow paradigm to configure the execution order of the code in your VI.

 

Button.PNG

Jarrod S.
National Instruments
Message 6 of 11
(4,267 Views)
Thanks for the update. When I went to NI's feature list of the base package I didn't fully extend the event structure tab. I saw it listed as one of the structures and assumed it was there. I have been fortunate enough to always work with the professional developer's suites. I wonder why they would remove this basic feature from the base package.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 7 of 11
(4,265 Views)

I wonder why they would remove this basic feature from the base package.

 

I think that the answer is simple.  $$$.  To me, the event structure should be essential to any LabVIEW programmer...so I'm not sure why it isn't included.  Was it ever included?

 

I find your title very deep.  Here is my solution:

 

I am running.png

Message 8 of 11
(4,254 Views)
What does it say when 2+2 != 4?
--
Tim Elsey
Certified LabVIEW Architect
Message 9 of 11
(4,214 Views)

Jarrod,

     The diagram you attached is what I am doing now. The problem is, when you double click on the VI and loading it in the memory without running it, vs. you click the 'run' button at upper left corner, there is no difference in the boolean text of the 'Ok' button.  Yes, we can always set the 'default' boolean text of the button as 'not running' so that it is different. However, I think there should be a better way of doing this.

     I agree with other comments about the event function. Many examples uses event function which make me feel that the base version is not a complete version.

 

Thanks,

 

Ryan

Message Edited by RyanWu on 10-09-2009 08:18 AM
0 Kudos
Message 10 of 11
(4,206 Views)