Data Backup and Initialization

Initialization of Variables, Overview

The initialization of variables to 0 or to the initialization value is performed by switching voltage ON, by a reset or after downloading the user program.

If internal variables shall be buffered, these variables have to be marked as “VAR_RETAIN” or “VAR_RETAIN PERSISTENT”. This applies to both the internal variables and the variables of the addressable flag area (%M area).

Note

Variables of the addressable flag area (%M area) for AC500-eCo CPUs PM55x and PM56x can not be buffered.

Note

The order of the internal RETAIN variables is only kept when using the online change command. If the program is re-built, the order can change and, due to this, the buffered variables do no match.See also CoDeSys / Retentive variables, chapter “Behavior of RETAIN
variables on download”: mainchapters/Remanentvariables

The following table shows an overview of the initialization values of the individual variables:

../_images/d0272dc08b8bde9d0a331390057b1b87

Note

For AC500-eCo CPUs, there is an 1 kByte VAR-RETAIN area and an 1 kByte %R area. Independently of an inserted battery, the memory values are stored in flash memory at power failures and are recovered when power returns. For the %R area, the values can be configured in Automation Builder under CPU Parameters.