Symbol Configuration

Use the symbol configuration for preparing symbols with specific access rights for project variables. Via these symbols you can access the variables from outside, for example from an OPC server. When generating code, CODESYS also generates a symbol file (*.xml) that includes the description of the symbols.

The symbol file is stored in the project directory. When downloaded, the file is loaded with the application to the PLC. The name of the symbol file is composed as follows: <project name>.<device name>.<application name>.xml

Example

proj_xy.PLC1.application.xml

Note

You can also generate the symbol file with the Generate code command. This is very useful when downloading to the PLC is not possible.

The variables that you export as symbols can be bundled in the symbol configuration editor or defined in the variables declaration using the {attribute 'symbol'} pragma. Another option is using the element in the SFC editor, where you can define the implicitly generated element variables that should be exported to the symbol configuration.

The name of the symbol is generated in the symbol configuration in the following syntax: <application name>.<POU name>.<variable name>. When accessing the variable, you must always provide the complete symbol name in this syntax.

Example

MyApplication.PLC_PRG.a or MyApplication.SymFB.a

Note

As a rule, read-only access applies to symbols for input addresses and for variables that are mapped to input channels. Write access is possible for testing purposes in simulation mode only.

The symbol file is loaded with the application to the PLC. Depending on the device description, this file can be generated as an additional (child) application. This application is then listed in the Application tab of the device editor. Syntax: <application name>._symbols. The symbol application is regarded as a “normal” application with respect to the maximum number of applications on the PLC.

See also

Creating a symbol configuration

Requirement: The project can be compiled without any errors.

  1. Select the Application object in the device tree.

  2. Click Project ‣ Add Object ‣ Symbol Configuration .

    ⇒ The Symbol Configuration object is added to the device tree and the objects editor opens.

  3. Open the View menu of the editor and activate the categories of variables that should be provided in the configuration editor: Click Build in the symbol configuration editor.

    ⇒ All variables (according to the currently defined filter in the View menu) are displayed in a tree structure.

  4. Select the check boxes of individual variables.

    Note: Pay attention to the current settings (see the Settings button in the menu bar of the editor).

    ⇒ In the field below the menu bar of the editor, information is provided about the current situation with accompanying instructions, as well as controls for corrective actions.

  5. Follow the prompt in the field below the menu bar. In the following case, this should be only the information that the modified symbol configuration is transferred with the next download or online change.

    Click Build ‣ Generate code in the CODESYS main menu.

    ⇒ The <project name>.<device name>.<application name>.xml file is generated in the project directory.

CODESYS transmits the symbol configuration to the PLC for an application download or online change.

See also