LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what causes the initialization action while the block diagram is clear cut

The sub.vi is very strange and I can't find out what is the cause, which drives me crazy.

Every time it was called the 'Delay Time' control reinitialized to its default, without any reinitializtion function or method in the block diagram!

I added the a 'ref' control to compare with it. which acts nomally. So I thought it's the 'Delay Time' control itself that was strange - not sub.vi. However when I copy the 'Delay Time' control to another vi to be called, it lost it strange characteristic and worked normally.

And when sub.vi is runned individually - not called, it works perfectly normal.

0 Kudos
Message 1 of 5
(2,216 Views)

I am not sure I inderstand your issue.

 

Any control on a subVI will take the default value if nothing is wired to it.

 

I think part of the issue may be the setting to Modal. When the subVI stop button is pressed the VI leaves memory. Thus no manual changes made during a previous call are preserved.

 

Lynn

0 Kudos
Message 2 of 5
(2,189 Views)

I'm not clear what you expect "delay time.vi" to do? The version included has the "delay time" control not connected to anything externally (from "Main") or internally (the "Wait(ms)" function. What the addition of the "reference" control is for is unclear as well. In the version you have included the default value of the delay time control is 1325 and the reference is 0. What are you expecting? When you run it and hit ok, the sub-vi pops up and runs, looping at a 100mS rate, doing nothing else until the stop is pressed. The Main.vi is not accessible until it the sub-vi is stopped.

 

What is the expected behavior of this example?

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



0 Kudos
Message 3 of 5
(2,175 Views)

Sorry I did not make the situation clear.

It's that you have to change the value of the two controls and call the sub.vi again to see what's strange there.

'ref' retains the value you give it next time you call the sub.vi, while 'Delay Time' always change back to 1325 (default) no matter what you changed it to.

However, if you run the sub.vi alone or copy 'Delay Time' to another vi, it works nomally and does not reinitialize to 1325 upon a second runing.

I deliberately have nothing connected to them to make the case clear and emphasize the intrinsic characteristic of the two controls.

 

0 Kudos
Message 4 of 5
(2,156 Views)

Hi, johnsold

Sorry I did not make the question clear enough. For simplicity, I made the default value of both contorls 0. See attachment.

As an instance, I changed both values to 12 at the first calling, then I call sub.vi again and found 'ref' retaining the value 12 while 'Delay Time' reinitialized back to 0. (Does it act like this on your PC?)

So I thought a certain property of 'Delay Time' control caused it to reinitialize upon every running. However, when I was running sub.vi alone, 'Delay Time' acted the same as 'ref'.

0 Kudos
Message 5 of 5
(2,148 Views)