Using Data Sources in VisualizationsΒΆ

Visualizations below an application can use the data sources below this application. As the user you can reference the data source variables in the configuration of a visualization element. You must specify the variables with the complete path: <Name of the device of the data source>.<Application name>.<Module name>.<Variable name>.

Requirement: There is a visualization under the application under which the data server is inserted. The visualization contains an element that should display a variable value that comes from another device in text form. In the procedure described here this variable is used on the other device in the application App_Dev1. Under the local DataServer a data source object is suspended that is linked with this other application. You have entered the desired variable as the selected variable in the data source editor.

  1. Select the visualization element in the editor window. Select the Text variables - Text variable property in the Properties window.

  2. You can select the desired variable of the data source via the Input Assistant. CODESYS inserts it with its complete path, starting from name of the device, in the Value field of the text variables. Example: enter the iTemp variable of the application App_Dev1, which is running on device Dev1: Dev1.App_Dev1.PLC_PRG.iTemp. It is also available to the local application via the DataServer.

  3. Select the Text property of the visualization element and enter the following: β€œTemperature: %s”. You thus obtain on the current visualization element as a text display the value that iTemp currently has on device Dev1.

  4. Load the application that represents the data source (in this example App_Dev1) to the controller and start this application.

  5. Load the application containing the data server and visualization to the controller and start this application.

    β‡’

    CODESYS displays the visualization in online mode. The element configured above displays the current value of iTemp.

Caution

Bit accesses used in visualizations that CODESYS executes via a data server connection function only if they contain literal offset specifications. CODESYS cannot process an offset specification via defined constants.

Attention

The visualization integrated in CODESYS does not display the current values of variables that are supplied from another data source via a data server! It displays only the initialization values or the last otherwise supplied values for these variables. Background: The integrated visualization does not perform any logon or logoff on the data server.

Attention

If the DataServer is to update variables that do not belong to the currently active visualization, the application must use the functions of the DataServer interface. These functions are provided in the DataServer interface library. You can call the functions in the IEC code via the g_DataServer object.

See also