To download NI software, including the products shown below, visit ni.com/downloads.
This example demonstrates how to use the Datalogging and Supervisory Control (DSC) functions to create user events for shared variables.
Description
This project demonstrates how to read shared variables with an event based architecture. The project includes a library of shared variables. Once deployed, these variables are updated from the "Change Shared Variable Value.vi". Each variable is bound to a front panel control.
When an update occurs, the event structure inside of the "Value Change Event for Shared Variables.vi" will fire and the value will be changed inside of an indicator for each shared variable. The event structure also keeps track of a timestamp for each update.
This method is perfect for creating a very efficient architecture that will not require constant polling of the shared variables within the application. It is also very efficient for large numbers of variables since it uses an array of variable constants to register for value change events.
Requirements
Software
Hardware
Steps to Implement or Execute Code
Additional Information or References
In order to use this example, you must have LabVIEW DSC module. The value change user events can only be created with this module installed. This example was created and used in the "All You Need To Know About Shared Variables" presentation.
**The code for this example has been edited to meet the new Community Example Style Guidelines. The edited copy is marked with the text ‘NIVerified’. Read here for more information about the new Example Guidelines and Community Platform.**
Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.
Using LV 2009, it seems like I can get "events" (the ability to detect a value change of a shared (network) variable) simply by binding a give varaible to a control. Once I establish a binding via the control's properties section, that control reflects any changes in the shared variable's value. Have things gotten easier in LV2009 compared to this 8.6 example, or am I missing something?
Hi Steve,
I like your idea binding a control to a network shared variable to achieve this scenario.
Could you upload your example code to this approach?
However, I think this example gives us a very good idea to handle large amount of IOs with minimum CPU usage.
I wonder if this works with I/O server method through OPC sever.
If yes, this would be a very good design pattern to communicate with PLCs.
Hi Ting1224,
Unfortunately, I can't provide any code.... that project is from a previous job and am no longer able to extract a sample.
For anyone coming across this, it seems that yes, front panel values will be updated with the shared variable's values, but they can't be used to trigger an event case that way.
It's as if the front panel is updated from a value property node instead of a value(sgnl) property node.