Shared Variable Not Updated When Changed

Updated Sep 14, 2023

Reported In

Software

  • LabVIEW

Issue Details

  • I created a Shared Variable of a specific representation (eg U8) and during further development of my code expanded it (eg to U16).
In my LabVIEW code I see saturated values when I go over the maximum of the original representation (255 for U8) as if the Shared Variable stayed in that original representation, and although the value is monitored correctly (values in the U16 range) in the Distributed System Manager , the shared variable still shows the previously configured representation.
  • I deleted an old IP and added a new IP for new controller. Now the shared variables are not working and are still referencing the old IP

Solution

Whenever there is an update to the shared variable you need to go through the following steps in order for the target to recognize the change: 
  1. As in figure below, Undeploy the Shared Variable by right-clicking on each one that has changed in your project, or by right-clicking on your whole library and selecting Undeploy. 
 
  1. Next, taking the figure below as your reference, you must Deploy the Shared Variable by right-clicking on each one that has changed in your project, or by right-clicking on your whole library and selecting Deploy
 
  1. A simple Deploy action will not have the required effect unless you Undeploy the variable.

Additional Information

The first time you deploy a variable, LabVIEW reserves space in memory to accommodate for your representation. After you change representation, LabVIEW checks through the variables and only looks for new ones to deploy. Since your shared variable has already been previously deployed, LabVIEW skips it and doesn't update its new representation. The Distributed System Manager will however see the change. So, if the variable has been deployed once already before the change, then you will need to first Undeploy and then Deploy again.