Type |
Class |
Global variable list |
Local variable list |
Definition |
||
---|---|---|---|---|---|---|
Program |
FUN |
FB |
||||
Global variables |
VAR_GLOBAL | l |
Non-hold global variable |
|||
VAR_GLOBAL_RETAIN | l |
Hold-type global variable |
||||
VAR_GLOBAL_CONSTANT | l |
Constant global variable |
||||
VAR_EXTERNAL | l |
l |
l |
Non-hold global variable |
||
VAR_EXTERNAL_RETAIN | l |
l |
l |
Hold-type global variable |
||
VAR_EXTERNAL_CONSTANT | l |
l |
l |
Constant global variable |
||
Local variables |
VAR | l |
l |
l |
Non-hold local variable |
|
VAR_RETAIN | l |
l |
Hold-type local variable |
|||
VAR_CONSTANT | l |
l |
l |
Constant local variable |
||
VAR_INPUT | l |
l |
Input variable |
|||
VAR_IN_OUT | l |
l |
Input and output variable |
|||
VAR_OUTPUT | l |
l |
Output variable |
|||
VAR_OUTPUT_RETAIN | l |
Hold-type output variable |
The value of the global variable can be changed by the PLC program wherever it is used. The initial value of this type of variable will only be read after switching the PLC from PROG to RUN mode or after a power failure.
Variables of this type are holding variables. The value of a holding variable is retained after a power failure, or after switching the PLC from PROG to RUN mode.
External variables are references to global variables. They allow usage of global variables in POUs.The value of constant variables remains unchanged throughout the entire program. It cannot be changed by the PLC program. These variables do not occupy any addresses in the PLC and are inserted as constant numbers into the program code.The initial value of a holding variable is read only after a cold start, i.e. when a program is downloaded to the PLC or when the INITIALIZE switch is activated in PROG mode.
External variables are references to global variables. They allow usage of global variables in POUs. The value of a holding variable is retained after a power failure, or after switching the PLC from PROG to RUN mode.
Variables of this class can be declared in any POU type and are used, e.g. to store intermediate results. Their values remain unchanged from one call to the next. Memory areas for these variables cannot be defined by the user, but are automatically assigned by the compiler. The initial value of this type of variable will only be read after switching the PLC from PROG to RUN mode or after a power failure.
Variables of this class enable parameters to be transferred to a function or function block. The variables have to be declared in the header of the function or function block. Variables of this class may not be used in PRG type POUs.
(1) |
input variables |
(2) |
function |
The value of an input variable can only be written within the calling POU, not within its own POU (except when the variable is being forced). Other POUs can read the input variable.
Variables of this class can be modified within the function program. Before jumping into the function program, the current parameters are copied to the formal parameters; after the return jump, the formal parameters will be copied back to the current parameters.
Formal parameters in the function program can be read and written.
Variables of this type can be used in function blocks only. The initial value of this type of variable will only be read after switching the PLC from PROG To RUN mode or after a power failure.
The value of an output variable can only be written within the function block in which it was declared. Other POUs can read the output variable.
In contrast to function blocks, functions have only one output, which has the name of the function, e.g. Fun_Desc:
Variables of this type can be used in function blocks only. The initial value of this type of variable will only be read after switching the PLC from PROG To RUN mode or after a power failure.
If under Initialize all variables except global retain variables with explicit addresses, variables for which the user assigned addresses are not reinitialized. , you activated
The value of an output variable can only be written within the function block in which it was declared. Other POUs can read the output variable.
In contrast to function blocks, functions have only one output, which has the name of the function, e.g. Fun_Desc: