Custom attribute
User-defined attributes are any application-defined or user-defined attributes that you can apply to POUs, actions, data type definitions and variables. You can query a user-defined attribute with the help of conditional pragmas before the compilation of the application.
Tip
You can query user-defined attributes with conditional pragmas with the operator hasattribute.
For more information and examples, see: Conditional Pragmas
Syntax:
{attribute 'attribute'}
Example 254. POUs and actions
Attribute 'vision' for function fun1
{attribute 'vision'}
FUNCTION fun1 : INT
VAR_INPUT
i : INT;
END_VARExample 255. Variables
'DoCount' attribute for ivar variable:
PROGRAM PLC_PRG
VAR
{attribute 'DoCount'};
ivar:INT;
bvar:BOOL;
END_VARExample 256. Data Types
Attribute 'aType' for data type DUT_1:
{attribute 'aType'}
TYPE DUT_1 :
STRUCT
a:INT;
b:BOOL;
END_STRUCT
END_TYPE