→Retentive and non-retentive variable: RETAIN, NON_RETAIN
Retentive variables are variables that are stored in a way that their values are conserved without changes for a →warm restart after the application has been stopped. Non-retentive variables are initialized anew with their →initial value, in case of a warm restart.
Declaration of |
in ST-editor, by using a keyword |
in a graphical editor, by using a prefix |
---|---|---|
retentive →variables |
|
|
non-retentive variables |
|
|
The keywords are only allowed for the sections VAR
, VAR_INPUT
, VAR_OUTPUT
and VAR_GLOBAL
but also for declared →function block instances. They are not allowed for program instances within the PLC-object.
The prefix is only allowed for internal variables, →input variables, →output variables and →global variables.