LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Help calling/running a subVI using boolean

Solved!
Go to solution

Hi, I'm working on a modification to one of my company's LV programs but I am new to it and trying to reverse engineer a lot of our software is proving difficult. I've picked up a lot of the basics but stuff like this is still throwing me off, so if anyone could help to explain in laymans terms how this process works and how I can tailor it to my needs it would be very helpful.

 

Basically I am trying to create an alert when a count in the main software reaches a certain point. When the count reaches this point, I need a new alert window to pop up, and I need it to be always on top so that it can't be ignored. The main program still needs to be able to operate in the background, but the alert must be clearly visible during operation. So I've used simple '<' operator to generate a boolean true/false depending on the count. 

 

I've attached my current files. In main, it compares the input number, and sets an event trigger if it is less than 200. This event trigger causes the subvi to run. However when it runs I'm getting this error: 

LabVIEW: (Hex 0x4AE) The VI is not in a state compatible with this operation. Change the execution mode of the referenced VI to reentrant for this operation.

 

I set the VI's reentrant property, and then it gives me this error:

LabVIEW: This property is writable only when the VI is in edit mode, or this method is available only when the VI is in edit mode.

 

However it is writable with the other property nodes so what am I doing wrong with this one? The end goal is to have the subvi pop up, stay always on top, and then go away when I click a button. Might be important to note that these files are pulled from another post on this forum showing how to keep a vi on top, and I've modified it to trigger an event from boolean.

 

0 Kudos
Message 1 of 7
(1,031 Views)

I don't understand why you use a reference to call your sub-vi.

 

The simple approach seems to work for me:

subviCapture.PNG

========================
=== Engineer Ambiguously ===
========================
0 Kudos
Message 2 of 7
(1,003 Views)

Your entire scheme is completely flawed.

 

  • You have a loop that can generate 10 alerts per second forever, lauching a subVI every time, even it if is already running.
  • You have a exec.istreentrant property for the current VI (not the subVI because the reference is not wired!), a property that is irrelevant here and not settable at runtime anyway.
  • Your subVI does a lot of song and dance that all can be avoided by just setting correct properties (e.g floating).
  • You are overusing event structures!. None are probably needed because you spin the loop anyway.
  • You only need exactly one loop.
  • Launch the subVI at the start of the program and keep it running forever. All you need to do is change the state between front-panel open or closed.

So instead of digging yourself into a deeper and deeper hole. Explain how the code should behave from a user perspective and lets go from there.

0 Kudos
Message 3 of 7
(997 Views)
Solution
Accepted by topic author ONse

See if this can give you some ideas.

 

altenbach_0-1663168824716.png

 

Note that this is just a proof of concept.

You should define in detail where the subVI should popup by changing its properties. Currently, it is just set as floating dialog. Placement on the diagram will run it and keep it running. All we change is the panel visibility.

Message 4 of 7
(984 Views)

@altenbach wrote:

See if this can give you some ideas.

 

altenbach_0-1663168824716.png

 

Note that this is just a proof of concept.

You should define in detail where the subVI should popup by changing its properties. Currently, it is just set as floating dialog. Placement on the diagram will run it and keep it running. All we change is the panel visibility.


thanks, this is what I was looking for. The problem I have now is that I can't use the main program while the popup is open. It needs to still be possible to run the main program (which is just a simple programming script that waits for a button press before executing). Do you know how I can do this?

0 Kudos
Message 5 of 7
(935 Views)

The main program runs just fine while the popup is open and you can even change the value and the popup will disappear when the condition ends. Have you tried? (you can finetune the behavior if you e.g. want the popup to stay)

 

(It is important to set the popup to "floating", not "modal". If it is "modal", you cannot interact with other windows.)

 

Please attach your code, else we cannot tell what you are doing wrong.

0 Kudos
Message 6 of 7
(928 Views)

@altenbach wrote:

The main program runs just fine while the popup is open and you can even change the value and the popup will disappear when the condition ends. Have you tried? (you can finetune the behavior if you e.g. want the popup to stay)

 

(It is important to set the popup to "floating", not "modal". If it is "modal", you cannot interact with other windows.)

 

Please attach your code, else we cannot tell what you are doing wrong.


Ah got it now, I created a different subvi and failed to change the settings for it. Thanks for your help 🙂

0 Kudos
Message 7 of 7
(925 Views)