The {attribute 'symbol'}
pragma defines which variables of a program or a global variable list are to be applied
into the symbol configuration. This means that the variables are exported as symbols
to a symbol list. This symbol list is then available for external access both as an
XML file in the project directory and as a file that is invisible to the user on the
target system. For example, the symbol list is then available for access by an OPC
server. The variables which are identified by a symbol are downloaded to the controller,
even if they are not explicitly configured or visible in the editor of the symbol
configuration.
In any case, however, a ⮫ “Object: Symbol Configuration ” has to be created below the affected application in the device tree.
Syntax:
{attribute 'symbol' := '
<access possibilities>
: none
, read
, write
, readwrite
. The default value readwrite
applies if no parameter is specified.
Insert location:
-
In order to affect only an individual variable, you need to place the pragma in the line before the variable declaration.
-
In order to be effective for all variables in the declaration part of a program, you must place the pragma in the first line of the declaration editor. In this case, too, you can still set instructions for individual variables explicitly in the respective line.
Example
With the following configuration the variables A
and B
are exported with read and write permission. Variable D
is exported with read permission.
{attribute 'symbol' := 'readwrite'} PROGRAM PLC_PRG VAR A : INT; B : INT; {attribute 'symbol' := 'none'} C : INT; {attribute 'symbol' := 'read'} D : INT; END_VAR
For more information, see: ⮫ Pragmas