This example demonstrates how to share variables within a network.
It consists of two applications. One is sending the variables and the other one receives them.
This example shows how variables can be exchanged between different systems within a network.
One device is sending a variables and the other one receives them.
To run the example, the applications need to run on different systems, due to the fact that a port
can only be used once on each system.
GVL_Send: Is a global variable list, which also includes the network settings in the global
variables properties (see screenshot). Port 1202 and the broadcast address can remain default.
With this setting everyone can receive the variables. Within a project it is possible that the
devices communicate either directly or via a file. If the sender and receiver are located in two
separate projects it is only possible to communicate via a file.
This example uses a file for communication. Right click the
GVL_Send and set in the
"Link to File"
property the file that should be used.
NVL: Is a global network variable list. The sender application or the imported file is set here.
Main_Receive: To check the result the values of the network variables are assigned to local variables.
Additionally some diagnostic information is retrieved.
In order to work correctly the sender application must be started before the receive app.
In this way the file which will be imported by the receiver can be created first.
If several senders on one system are used, different ports have to be defined for correct communication.
|System requirements and restrictions||Info|
|Programming System||CODESYS Development System Version 126.96.36.199 or higher|
|Runtime System||CODESYS Control Version 188.8.131.52|