LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI default value

A SubVI in my LabVIEW program has a boolean terminal. It's default value is false. My LabVIEW front panel has two instances of SubVI. Boolean terminal of the one of the instance is TRUE while other has FALSE as its default value.

 

Problem is that other instance is also getting TRUE value, even if it has FALSE as its default value.

0 Kudos
Message 1 of 18
(2,808 Views)

Does not compute!

 

Show us the code.

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
0 Kudos
Message 2 of 18
(2,803 Views)

It would be easier to follow along if you had attached all your VI's.  How do you know it is getting true when it should be getting false?

 

What do you mean by 2 instances of a subVI?  Is it a single subVI dropped into 2 places in your main VI's block diagram?

Is that subVI re-entrant or non-reenntrant?  A non-reentrant subVI has only 1 copy in memory.  It can only run once at at a time even if multiple copies on your main VI are ready to call it.  One will be blocked until the other is finished calling it.  If you open its front panel/block diagram, any probes, FP indicators and controls will show whatever is happening for which ever instance is being called at that moment.  When the other instance runs, then it will show the data for that instance.

 

Have you tried running your code with highlight execution turned on so you can see how the data flows in slow motion?  If the code is running too fast, the 2 copies of the subVI may be called in such rapid succession you can't tell if copy 1 is running or copy 2 is running.

0 Kudos
Message 3 of 18
(2,796 Views)

When you set the default value of one instance, I believe you set the default value for ALL instances.  I'm guessing "TRUE" was the last default saved.

 

NOTE: I've never tried setting default values on CLONES before, so I don't know if that holds true for clones.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 4 of 18
(2,770 Views)

If you need two "default values", you should be wiring a constant to them anyway.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 5 of 18
(2,768 Views)

@gkartik wrote:

A SubVI in my LabVIEW program has a boolean terminal. It's default value is false. My LabVIEW front panel has two instances of SubVI. Boolean terminal of the one of the instance is TRUE while other has FALSE as its default value.

 


SubVIs live on the block diagram, not on the front panel (unless you use subpanels. Do you?). Do you mean the subVI is reentrant and you have two instances open?

 

Let's make sure you are using the correct terminology. If you close LabVIEW and open it without running, are the booleans really still different? Are you absolutely sure both point to the same file?

 

After/during run, an open front panel shows the most recent value and these can be different for reentrant VIs. We need to have more details to troubleshoot further.

0 Kudos
Message 6 of 18
(2,755 Views)

A control\indicator that is not connected to the connector pane doesn't reset it's value to default. Not even for different instances. At least not by default (you can turn this on).

 

Basically, a control\indicator on the front panel can be used just like a shift register... It retains it's value.

Message 7 of 18
(2,728 Views)

wiebe@CARYA wrote:

A control\indicator that is not connected to the connector pane doesn't reset it's value to default. Not even for different instances. At least not by default (you can turn this on).

 

Basically, a control\indicator on the front panel can be used just like a shift register... It retains it's value.


Please correct me if I'm wrong, but I think your statement only applies to an indicator.  If it applied to a control, you could never rely on a subVI using the default value of the control if you leave its terminal unwired in the higher level VI.

0 Kudos
Message 8 of 18
(2,714 Views)

@RavensFan wrote:

wiebe@CARYA wrote:

A control\indicator that is not connected to the connector pane doesn't reset it's value to default. Not even for different instances. At least not by default (you can turn this on).

 

Basically, a control\indicator on the front panel can be used just like a shift register... It retains it's value.


Please correct me if I'm wrong, but I think your statement only applies to an indicator.  If it applied to a control, you could never rely on a subVI using the default value of the control if you leave its terminal unwired in the higher level VI.


It applies to controls and indicators but only if they are not connected to the connector pane.

 

I'm not convinced the control is connected to the CP is in this case, as OP only mentioned that 'there is a terminal'.

0 Kudos
Message 9 of 18
(2,704 Views)

Okay.  Fair enough.   I was seeing the problem as having it on the connector pane just by the way the OP was saying he has a boolean terminal.

 

It really isn't any point talking about this more until they come back and actually clarify what they are talking about.

 

I hate these threads where someone posts an ambiguous question, we spend time debating it and all its variations, and they either do not come back to clarify like asked, or they come back and the issue is something completely different than what they described.

Message 10 of 18
(2,698 Views)