LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

SubVI Value not updating when connected to connector pane

Solved!
Go to solution
Can you post this subVI which you tried to simulate with and without in the post : http://forums.ni.com/t5/LabVIEW/SubVI-Value-not-updating-when-connected-to-connector-pane/m-p/334257...
Thanks
uday
0 Kudos
Message 11 of 22
(2,362 Views)

Attached is the project, with a main and two sub vi's one with the connector pane connected, and one without.  If you look at the Freq on the two subVI front panels you should be able to notice my issue.

0 Kudos
Message 12 of 22
(2,362 Views)

Connect Frequency Output to connector pane and check!!!

 

Thanks
uday
0 Kudos
Message 13 of 22
(2,354 Views)

When I do that Frequency Output doesnt update.  In the end I want the Sub Vi Output - Channel 37 to show the Freq (or Frequency output, its equal to Freq).  

 

When I connect anything to the output of the subVi, it always comes up 0.

0 Kudos
Message 14 of 22
(2,350 Views)

The ones that "work" are updating to the proper values as expected, and follow when I make changes at the sensor.  It isn't that they are "stuck". 

 

I'm not sure how many times I can say this, when I do not connect the output to the connector pane it works fine.  The SubVi is working, I just can't get the output out of it.  


I've ran highlight execution, as well as probes.  When I probe the wire going to the Frequency Output (the only place its being written to) indicator the probe shows the correct value.  There is something going on with the connector pane / UI updating that is causing it to fail to update.  

0 Kudos
Message 15 of 22
(2,339 Views)

Have you read what I wrote in message #4?

 

I will repeat it here.

 


But the real problem is your subVI only has one input, "Input", and one output, "freq".  But you have a lot of other controls and indicators in there whose values are only defined by their defaults within the subVI.

 

Start with turning on highlight execution on this subVI, and watch the dataflow when you run your main VI.  Up front you look at counter <= Samples.  These values aren't on the connector pane.  They are both 0.  So the are Equal and thus the true case runs.  Inside you use the input value to work on an Output Array, which is empty and will likely remain empty, but never goes anywhere after this subVI.  And increment Counter which is 0 to start, but Counter never leaves this subVI.

 

In the end, you do a little work on meaningless default data, but basically accomplish nothing because it never goes anywhere.

 

I would recommend looking at the online LabVIEW tutorials
LabVIEW Introduction Course - Three Hours
LabVIEW Introduction Course - Six Hours



Have your run your subVI with highlight execution turned on so you can see how the data is being calculated?  You get nothing because you are using values that have default data and those calculations run a case that does nothing to the lone output you have.  The case that would update the indicator to pass dat out never runs.  Your subVI has 3 controls and 5 indicators.  But only 1 control is connected to the connector pane (inside the subVI).  Only 1 indicator is connected to the connector pane.  And that indicator never gets any new value.

 

Smiley Frustrated

0 Kudos
Message 16 of 22
(2,336 Views)
Solution
Accepted by topic author lilmaniac2

The values are updating very fast can you keep some delay in main vi and then check i could see the values updated.
-The problem is whenever subvi enters in false case then only the value is sent to main vi in TRUE case it is not and the value immediately turns to 0.

 

Edit: If you want the value of your main vi indicator to be updated only in false case and true case nothing, try creating reference to it and pass to subvi and update in false cass of subvi(It works!!!)

Thanks
uday
Message 17 of 22
(2,336 Views)

Uday,


I am seeing the same thing you are now that I slowed down the main loop.  (I'm still confused as to why this is affected by making a connection on the connector pane)

 

Shouldn't the main loop wait for the sub vi to finish executing (there is a for loop inside of the sub vi) or since its a timed loop does it override that some how?

 

I had played around with the reference creation, but that will get messy when I have 45 of these subvi's to keep track of.  

 

Thanks again for the help.

0 Kudos
Message 18 of 22
(2,329 Views)

Okay.  Read this thread.  http://forums.ni.com/t5/LabVIEW/Does-it-matter-where-you-place-terminals-on-the-block-diagram/td-p/3...

 

It references what is known as the "Clear as Mud" thread.  Basically terminals that are NOT on the top level of the block diagram behave differently depending on whether the terminal is connected or not, and whether the terminal actually executes.  In your case, the terminal doesn't execute, so the behavior between connected and unconnected is different.

 

In your case, it is all a moot point because you have other flaws in your subVI that need to be fixed.

I am mistaken in that the False case always runs.  It looks like the counter value does update and the outpu array does change due to the other side of the equation as to whether the terminals are top level and connected or not.

 

At the end of the day, you need to rewrite this subVI.  Get rid of the local variables.  If you need to store values in the subVI use feedback nodes or uninitialized shift register.

Message 19 of 22
(2,326 Views)
The value does get updated inside subvi when it is connected to Connector pane and when it is not.
-The problem when it is connected to pane is in TRUE case inside your subvi this terminal value is not given and hence it takes default(0) which appears as it is not updated.
Thanks
uday
0 Kudos
Message 20 of 22
(2,322 Views)