If they are supported by the runtime system, remanent variables may be processed. There are two types of remanent global variables:
-
Retain variables remain unchanged after an uncontrolled shutdown of the runtime system (off/on) or an 'Online' 'Reset'⮫ “'Online' 'Reset'”.
-
Persistent variables remain only unchanged after a program download⮫ “'Online' 'Download'”.
Persistent variables are not automatically also Retain variables !
Remanent variables are additionally assigned the keyword RETAIN and/or PERSISTENT.
Syntax:
VAR_GLOBAL RETAIN (* Variables declarations *) END_VAR VAR_GLOBAL PERSISTENT (* Variables declarations *) END_VAR
For the combination of retain and persistent properties both keywords are used:
VAR_GLOBAL RETAIN PERSISTENT
or
VAR_GLOBAL PERSISTENT RETAIN