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.
The following categories are displayed for variables in the Input Assistant:
-
PROGRAM POU: local variables and global variables -
FUNCTION_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).
Variables for program POU - Basic Level
-
VAR -
VAR CONSTANT -
VAR_EXTERNALfor channel variables and stack instances -
VAR_EXTERNAL CONSTANTallowed only fromVAR_GLOBAL CONSTANT
Variables for function block POU - Basic Level
-
VAR -
VAR CONSTANT -
VAR_INPUT -
VAR_OUTPUT
Meaning of the keywords
-
VAR: Declaration of normal internal variables, POU-wide variable -
VAR_INPUT: Declaration of input variables -
VAR_OUTPUT: Declaration of output variables -
The
CONSTANTmodifier serves the declaration of symbolic constants
Variables for program POU - Extended Level
-
VAR -
VAR CONSTANT -
VAR_EXTERNAL -
VAR_EXTERNAL CONSTANT
Variables for function block POU - Extended Level
-
VAR -
VAR CONSTANT -
VAR_INPUT -
VAR_OUTPUT
Meaning of the keywords:
-
VAR: Declaration of normal internal variables, POU-wide variable -
VAR_INPUT: Declaration of input variables -
VAR_OUTPUT: Declaration of output variables -
VAR_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
Already existing variables of the "global variables" category are available for the declaration as 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
-
BOOL -
INT: Only as a constant input parameter for a function block call -
DINT: Only as a constant input parameter for a function block call -
WORD: Only as an output for diagnostic purposes -
TIME: Only as a constant input parameter in a function block call -
SAFEBOOL -
SAFEINT: Only as constant function block input in a call -
SAFEDINT: Only as a constant input parameter in a function block call -
SAFEWORD: Only as a constant input parameter in a function block call -
SAFETIME: Only as a constant input parameter in a function block call
The REAL data type is not available.
The following data types are available to the developer for the implementation of a POU in the Extended programming level.
Safety standard types:
-
BOOL -
BYTE: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environment -
DINT -
DWORD: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environment -
INT -
TIME: Allowed as a constant input parameter and for local variables.External declarations of global variables of the type
SAFETIMEare not permissible -
WORD: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environment -
No
REALdata type -
SAFEBOOL -
SAFEBYTE: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environment -
SAFEDINT -
SAFEDWORD: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environment -
SAFEWORD: For the exchange of encoded information (status code, diagnostic code, control code) between predefined function blocks and the environment -
SAFEINT -
SAFETIME; 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.