From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Shared Variable Example - Explanations

Solved!
Go to solution

First off, this is my first post in the forums. If I should post this in a better place I'll take the constructive criticism.

 

I was going through the Example Project > Shared Variable.lvproj and a couple of things did not make sense and were not explained by the comments. I am hoping someone could provide clarity.

 

-In the "Shared Variable Client - Front Panel Binding.vi" VI, the VI continues run even though there is no while loop. What makes this happen?

-What is the functional difference between a Shared Variable and a Bound Shared Variable?

0 Kudos
Message 1 of 5
(3,489 Views)
Solution
Accepted by topic author jwilliams17

Welcome to the forums.  This is the appropriate place to post your question.

 

The VI is running.  It has not had a chance to complete its code.  It has an event structure in there that is waiting for an event to happen.  It has only one event that is waiting for a value change on the Stop button.

 

A shared variable is part of a library that when it is deployed keeps track of values so that other VI's can access the data.  Even VI's on other PC's if you are using network shared variables.  Normally you'd have to read data from and write data to the shared variables.  When the shared variables are bound, that means a control on the front panel is bound to that shared variable.  It will be updated with the SV's value automatically by way of some background LabVIEW processes.  (Either direction depending on if it is a control or indicator, and whether the access type is read, write, or read/write.)

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

@jwilliams17 wrote:

 

-What is the functional difference between a Shared Variable and a Bound Shared Variable?


I think things got mixed up here.

 

"Binding" variables is used for different concepts:

1) Binding Shared Variables and Other NI-PSP Data Items to Controls and Indicators

2) Creating Bound Variables (DSC Module or Real-Time Module)

0 Kudos
Message 3 of 5
(3,451 Views)

I get that the VI doesn't end because the Event structure hasn't executed. But without a While Loop, why do the waveform charts continue to query the shared variable value? I would think they would populate one data point and then stop.

0 Kudos
Message 4 of 5
(3,403 Views)

Because the background process that handles shared variables is updating the screen.

 

I called is a "LabVIEW process", but actually it is not the LabVIEW run-time system doing it.  The development environment is open, but it isn't actively running LabVIEW code.  The Shared Variable Service (it might be some variation of that name) that runs in the background continuously is doing the updating because it knows that indicator object is bound to a shared variable.

Message 5 of 5
(3,394 Views)