Declaring VAR_CONFIG section within a VarCfg-object
You require a VAR_CONFIG
section to assign instance specific locations to symbolically represented variables. This section is possible within a →configuration as well as within a →resource.
This article describes the declaration of the VAR_CONFIG
section within a VarCfg-object.
The declaration of the VAR_CONFIG
section within a VarCfg-object allows you to collect the declaration in one or more central objects for the project. Subsequently, you just insert a reference where you will need the declaration – this will be a resource or a configuration.
Enhancement to the →IEC-standard. This possibility is an enhancement to the →IEC-standard. |
Creating VarCfg-object
Create a VarCfg-object by using the command VarCfg-Object (e.g. in the context menu for a project, under New). In the wizard, you have to select whether the VAR_CONFIG section is intended to be referenced in a configuration or resource.
See "Creating new objects and folders" for generic information on creating the objects.
VAR_CONFIG section in VarCfg-object for central declaration
Insert the lines with the instance specific location assignment for symbolically represented variables within the automatically created VAR_CONFIG
section of the opened VarCfg-object. These lines correspond to the lines as they are possible within a VAR_CONFIG
section of an PLC-object. One VAR_CONFIG
section is possible per VarCfg-object.
Syntax |
---|
|
Meaning |
---|
declaration of the As already indicated, the syntax for |
Example 1: Content of a VarCfg-object, to be referenced within a resource |
---|
|
Example 2: Content of a VarCfg-object, to be referenced within a configuration |
---|
|
For these examples to be free of errors, provide the declarations of the corresponding variables and/or data types (see "Addendum for examples 1 to 3" under "Declaring VAR_CONFIG sections within PLC-object").
Reference in a resource and/or configuration
In the PLC-object, insert the INCLUDE_VARCFG directives to reference the appropriate section in the VarCfg-object.
Syntax |
---|
|
Insert the INCLUDE_VARCFG
directive before the end of a resource (END_RESOURCE
) or the end of a configuration (END_CONFIGURATION
). But always insert the INCLUDE_GLOBALS
directives in front of a possibly existing section VAR_CONFIG ... END_VAR
.
Example 3: INCLUDE_VARCFG directives, one within a configuration and the other in a resource |
---|
|