From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Why Shared Variable of a control doesn't work like its Local Variable?

Dear forum members,

I was expecting that shared variable of a control will work across 2 VIs as its local variable in the same VI?

 Why it doesn't work?

Thanks in advance,

Rani.

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

What do you mean by "shared variable of a control"?

 

Controls don't have shared variables.  Shared variables are stored in libraries that get deployed when you run your VI.

 

What are you doing that you say "it doesn't work"?  Post your VI's and shared variable library so we can see what you are doing.

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

Hi,

Thank you for the reply. Attached is a simple vi that show that a share variable created for Boolean does not work like local Variable.

 

What I'm really trying to do is to communicate a pressed button (Boolean)  on RT target to the Host. Any suggestion?

 

Thanks,

Rani

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

Did you create a project that contains both your VI and your shared variable library?

 

You do know that the 2nd loop in your VI will not run until you've hit the stop button due to the data dependency created by the wire runing from the first loop to the second.  Don't you?

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

Hi,

Sorry for the delay with my response.

 

Yes, I did have the vi and the variable library in a project.

I finally realized my mistake, when I created the Shared Variable I should have left it connected to the Boolean control. (modified vi attached).

 

Thank you for replying and for the heads up with the stop button wire, I have much to learn about Labview.

Rani.Smiley Happy

 

 

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