Initialization of Variables, Overview

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

AC500 supports all in IEC61131-5 defined types of buffered data:

  • VAR RETAIN - keep their value during online change
  • VAR PERSISTENT - keep their value during online change and download
  • VAR RETAIN PERSISTENT - keep their value during online change, download and power OFF/ON.

For this the variable are copied before and after download one by one. This copy process can take a long time.

So it is recommended to use VAR RETAIN PERSISTENT only, if there is a small amount (less 100) of buffered variables.

In addition to the IEC61131-2 buffered variable types AC500 provides the so called PERSISTENT area (%R area). See detailed description Inputs, Outputs and Flags for AC500 V2 Products.

The big advantage of the %R area is that there is no copy of variables necessary!

So its recommended to use the %R area for buffered variables.

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 Processor Modules cannot be buffered.

Note

The order of the internal RETAIN variables is only kept when using the online change command.

If the program is rebuilt, the order can change and, due to this, the buffered variables do no match. See IEC 61131-3 editorRemanent variables: Remanent Variables - RETAIN, PERSISTENT

Consider the description on the behavior of RETAIN variables on download.

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

../_images/ae7362a8ed097dc00a317f3413cbd1f9

Note

For AC500-eCo Processor Modules, there is a 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.