Variables
This section contains:
Keywords of the variable declaration for Basic Level
Keywords of the variable declarations for Extended Level
Basic Level data types
Extended Level data types
The keywords and data types that are available depend on the programming level of the POU.
In the FBD program code, which is created in the Safety FBD editor, variables appear exclusively in the form of names (symbolic variables). You can use a simple name, an identifier as per IEC. An identifier with which a variable is referenced in the implementation section must be declared in the declaration section (see Variable Declaration Editor) of the POU.
Categories for variables in the Input Assistant
The following categories are displayed for variables in the Input Assistant:
PROGRAM POU: local variables and global variablesFUNCTION_BLOCK POU: local variables
The Local variables category encompasses all variables of the local declaration section, including VAR_EXTERNAL.
The Global variables category encompasses all variables of the GVLs of the application, all mapped I/Os and all implicit instances of the logical I/Os (see: I/O Mapping).
Keywords of the variable declaration for Basic Level
VARVAR CONSTANTVAR_EXTERNALfor channel variables and stack instancesVAR_EXTERNAL CONSTANTallowed only fromVAR_GLOBAL CONSTANT
VARVAR CONSTANTVAR_INPUTVAR_OUTPUT
VAR: Declaration of normal internal variables, POU-wide variableVAR_INPUT: Declaration of input variablesVAR_OUTPUT: Declaration of output variablesThe
CONSTANTmodifier serves the declaration of symbolic constants
Keywords of the variable declarations for Extended Level
VARVAR CONSTANTVAR_EXTERNALVAR_EXTERNAL CONSTANT
VARVAR CONSTANTVAR_INPUTVAR_OUTPUT
VAR: Declaration of normal internal variables, POU-wide variableVAR_INPUT: Declaration of input variablesVAR_OUTPUT: Declaration of output variablesVAR_EXTERNAL: Declaration of global variables already declared in the application withVAR_GLOBAL, in order to make them usable in the POU.Global variables having the
CONSTANTmodifier must be declared asVAR_EXTERNAL CONSTANT.The
CONSTANTmodifier serves the declaration of symbolic constants
VAR_EXTERNAL and VAR_EXTERNAL CONSTANT:Global variables of the GVL object of the safety application.
If a variable of the GVL object of the safety application is used in the implementation section, then it is automatically declared as an external variable in the declaration section.
According to IEC it is explicitly forbidden to use global variables in a POU without declaring them as "External".
Mapping variables of the logical I/Os (logical exchange devices and safe field devices)
Basic Level data types
BOOLINT: Only as a constant input parameter for a function block callDINT: Only as a constant input parameter for a function block callWORD: Only as an output for diagnostic purposesTIME: Only as a constant input parameter in a function block callSAFEBOOLSAFEINT: Only as constant function block input in a callSAFEDINT: Only as a constant input parameter in a function block callSAFEWORD: Only as a constant input parameter in a function block callSAFETIME: Only as a constant input parameter in a function block call
The REAL data type is not available.
Extended Level data types
The following data types are available to the developer for the implementation of a POU in the Extended programming level.
BOOLBYTE: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environmentDINTDWORD: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environmentINTTIME: Allowed as a constant input parameter and for local variables.External declarations of global variables of the type
SAFETIMEare not permissibleWORD: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environmentNo
REALdata typeSAFEBOOLSAFEBYTE: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environmentSAFEDINTSAFEDWORD: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environmentSAFEWORD: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environmentSAFEINTSAFETIME; Allowed as a constant input parameter and for local variables.External declarations of global variables of the type
SAFETIMEare not permissible if they are neither symbolic constants nor imported logical I/Os.
The REAL data type is not available.