When choosing a method of reading and writing shared variables, you must consider several factors, including the following:
The following table describes the use cases, advantages, and disadvantages of the methods you can use to read and write shared variables over a network.
Note��After you program your applications to read and write shared variables with one or more of the following features, you must deploy the shared variables to make them available on the network. |
Method of Reading and Writing Shared Variables | Recommended Uses | Advantages | Disadvantages |
---|---|---|---|
Programmatically with the Shared Variable functions | Reading and writing large numbers of shared variables. For example, if you need to read 50 shared variables of the double data type in a specific project library, reading those shared variables programmatically is the most efficient method. |
|
Requires more programming than other methods because you must program your application to read and write shared variables that meet specific criteria. |
With Shared Variable nodes |
|
|
|
With controls and indicators | Reading and writing data at a slow rate in an HMI application. For example, if you need to display the latest value from a temperature sensor once every few seconds, read shared variables with an indicator. | Ease of programming. To read or write a shared variable with a control or indicator, drag a shared variable from the Project Explorer window to the front panel of your application. |
|
With existing data sources | Leveraging shared variable features for a data source that does not support those features. For example, real-time targets do not support DSC Module logging and alarming properties. Therefore, if you need to set DSC Module logging and alarming properties for a shared variable on a real-time target, you could create a new shared variable on your development computer, write that shared variable with the shared variable on the CompactRIO target, and configure the shared variable on the development computer for logging and alarming. |
|
If you do not need to leverage shared variable features for a data source or if the data source already supports the features you need, this method is inefficient because you can read and write the data source directly. |
With the DataSocket functions | Reading and writing shared variables from Mac and Linux computers. | The DataSocket functions are the only programming tools you can use to read and write shared variables from Mac and Linux computers. |
|
With the variable Web service | Reading and writing shared variables from Web-enabled platforms that support HTTP. |
|
If you do not need to leverage shared variable features for Web-enabled platforms that support HTTP, this method is inefficient and requires more programming than other methods. |