04-09-2019 02:21 PM - edited 04-09-2019 02:23 PM
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.
04-09-2019 02:24 PM
Does not compute!
Show us the code.
Ben
04-09-2019 02:28 PM
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.
04-09-2019 03:57 PM
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.
04-09-2019 03:59 PM
If you need two "default values", you should be wiring a constant to them anyway.
04-09-2019 06:11 PM
@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.
04-10-2019 03:39 AM
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.
04-10-2019 06:52 AM
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.
04-10-2019 07:15 AM - edited 04-10-2019 07:19 AM
@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'.
04-10-2019 07:25 AM
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.