Addressable PERSISTENT Area (%R area)¶
Special Features
The addressable PERSISTENT area or %R area has the following peculiarities:
- Variables declared in the %R area are always located at the same position in the PLC’s operand memory, because they have addresses assigned (like the variables in the %M area).
- Variables in the %R area are declared as follows:
VAR (caution: no RETAIN or PERSISTENT option),
Symbol AT %RTypeSegment.Offset : TYPE; (* Comment *), or also
Symbol AT %RTypeSegment.Offset : ARRAY[start..end] OF TYPE (* Comment *)
END_VAR
where: | Symbol | symbolic name of the variable |
Type | X=BOOL (Bit), B=BYTE, W=WORD, D=DWORD | |
Segment | 0..15 (availability depends on CPU type) | |
Offset | 0..65535 (availability depends on CPU type) | |
TYPE | BOOL, BYTE, WORD, DWORD or defined type (such as structure) | |
start | Index of the first ARRAY element | |
end | Index of the last ARRAY element |
- For each segment in the %R area, an area can be set in the PLC configuration, which is buffered in case the battery is installed and fully charged. In this case, the variables behave like variables declared as VAR RETAIN PERSISTENT, i.e., they keep their values even after
- Online changes (like all other variables),
- Power OFF/ON (like VAR RETAIN), and
- download (like VAR PERSISTENT).
- In contrast to the variables declared as VAR PERSISTENT, these variables have the great advantage that no program code is required for dumping the variables during a download.
- The buffered part of the %R area can be written to the SD Card and read from the card (see <no title>).
Segmentation
The addressable PERSISTENT area in the AC500 is divided into several segments with a size of 64 kbytes per segment. A maximum of 8 segments can be addressed. The availability of the segments or partial segments depends on the CPU:
Operands | eCo(-ETH) PM55x PM56x |
PM572 | PM573-ETH PM582 PM583-ETH |
PM590-ETH PM591-ETH/2ETH PM592-ETH |
PM595- 4ETH | |
---|---|---|---|---|---|---|
%R retain & PERISISTENT | 1 kB | 4 kB | 128 kB | 512 kB | 1024 kB | |
Segment 0 | %RB0.0…%RB0.65535 | |||||
Segment 1 | %RB1.0…%RB1.65535 | |||||
Segment 2 | %RB2.0…%RB2.65535 | |||||
Segment 3 | %RB3.0…%RB3.65535 | |||||
Segment 4 | %RB4.0…%RB4.65535 | |||||
Segment 5 | %RB5.0…%RB5.65535 | |||||
Segment 6 | %RB6.0…%RB6.65535 | |||||
Segment 7 | %RB7.0…%RB7.65535 | |||||
Segment 8 | %RB8.0…%RB8.65535 | |||||
Segment 9 | %RB9.0…%RB9.65535 | |||||
Segment 10 | %RB10.0…%RB10.65535 | |||||
Segment 11 | %RB11.0…%RB11.65535 | |||||
Segment 12 | %RB12.0…%RB12.65535 | |||||
Segment 13 | %RB13.0…%RB13.65535 | |||||
Segment 14 | %RB14.0…%RB14.65535 | |||||
Segment 15 | %RB15.0…%RB15.65535 |
Saving the Buffered Data of the %R Area
The buffered part of the %R area can be saved on the SD card and read from the card. This can be necessary, if, for example, the controller has to be replaced.
Copy the data from the %R area and write it to the CPU’s RAM disk as file
Save the file to the SD Card.
Load the file from the SD Card to the CPU’s RAM disk.
Copy the data from the RAM disk to the %R area.
Caution
Data mismatch can occur!
The variables structure / layout has to be identical to the old one and should not be changed!
Saving and reading the data can be done using Function Blocks in the user program or with the PLC Browser contained in the Automation_Builder. The Function Blocks are contained in the SysInt_AC500_V10.lib: Contents-Internal-System-Library
Function | PLC Browser command | Function Block |
---|---|---|
Copy from %R area to RAM disk | persistent save | PERSISTENT_SAVE |
Save file to SD Card | persistent export | PERSISTENT_EXPORT |
Read file from SD Card to RAM disk | persistent import | PERSISTENT_IMPORT |
Copy data from RAM disk to %R area | persistent restore | PERSISTENT_RESTORE |
Delete buffered data of the PERSISTENT area | persistent clear | PERSISTENT_CLEAR |
Caution
:strong:Cycle consistency for data
If cycle consistency is required for the data, this has to be implemented in the user program. That means, that the data may not be changed during copying to/from the %R area from/to the RAM disk. If saving is done using the PLC Browser, this can be easily carried out by stopping the user program.
Caution
:strong:Cycle time for copying the PERSISTENT area
Copying the PERSISTENT area takes some milliseconds (see the following table). Thus, an according cycle time has to be set in the task configuration. Please note the remarks on the task configuration!
Action | Time in ms | |||
---|---|---|---|---|
CPU PM55x CPU PM56x |
CPU PM57x | CPU PM58x | CPU PM59x | |
Restoring 1 kB (1024 bytes) | ||||
PERSISTENT_CLEAR | <1 | <1 | <1 | <1 |
PERSISTENT_SAVE | 2 | 2 | 2 | 2 |
PERSISTENT_EXPORT | 900 | 1000 | 1000 | 500 |
PERSISTENT_IMPORT | 100 | 500 | 1000 | 500 |
PERSISTENT_RESTORE | 3 | 2 | <1 | 1 |
Restoring 4 kB (4096 bytes) | ||||
PERSISTENT_CLEAR | not possible | <1 | <1 | <1 |
PERSISTENT_SAVE | not possible | 2 | 3 | 2 |
PERSISTENT_EXPORT | not possible | 1000 | 1000 | 500 |
PERSISTENT_IMPORT | not possible | 500 | 1000 | 500 |
PERSISTENT_RESTORE | not possible | 3 | 3 | 2 |
Restoring 64 kB (65536 bytes) | ||||
PERSISTENT_CLEAR | not possible | not possible | 8 | 2 |
PERSISTENT_SAVE | not possible | not possible | 11 | 6 |
PERSISTENT_EXPORT | not possible | not possible | 2500 | 1000 |
PERSISTENT_IMPORT | not possible | not possible | 2000 | 500 |
PERSISTENT_RESTORE | not possible | not possible | 12 | 5 |
Restoring max. PERSISTENT area | ||||
4 kB | 128 kB | 512 kB | ||
PERSISTENT_CLEAR | <1 | <1 | 17 | 22 |
PERSISTENT_SAVE | 2 | 2 | 22 | 35 |
PERSISTENT_EXPORT | 900 | 1000 | 4000 | 8000 |
PERSISTENT_IMPORT | 100 | 500 | 3000 | 4000 |
PERSISTENT_RESTORE | 3 | 3 | 22 | 31 |
Access to Operands in the Addressable PERSISTENT Area (%R Area):
The operands in the %R area can be accessed bit-wise, byte-wise, word-wise and double-word-wise.
Byte SINT / BYTE | Bit (byte-oriented) BOOL | Word INT / WORD | Double word DINT / DWORD |
---|---|---|---|
Segment 0 | |||
%RB0.0 | %RX0.0.0 … %RX0.0.7 | %RW0.0 | %RD0.0 |
%RB0.1 | %RX0.1.0 … %RX0.1.7 | ||
%RB0.2 | %RX0.2.0 … %RX0.2.7 | %RW0.1 | |
%RB0.3 | %RX0.3.0 … %RX0.3.7 | ||
%RB0.65532 | %RX0.65532.0…%RX0.65532.7 | %RW0.32766 | %RD0.16383 |
%RB0.65533 | %RX0.65533.0…%RX0.65533.7 | ||
%RB0.65534 | %RX0.65534.0…%RX0.65534.7 | %RW0.32767 | |
%RB0.65535 | %RX0.65535.0…%RX0.65535.7 | ||
Segment 1 | |||
%RB1.0 | %RX1.0.0…%RX1.0.7 | %RW1.0 | %RD1.0 |
%RB1.1 | %RX1.1.0…%RX1.1.7 | ||
%RB1.2 | %RX1.2.0…%RX1.2.7 | %RW1.1 | |
%RB1.3 | %RX1.3.0…%RX1.3.7 | ||
%RB1.65532 | %RX1.65532.0…%RX1.65532.7 | %RW1.32766 | %RD1.16383 |
%RB1.65533 | %RX1.65533.0…%RX1.65533.7 | ||
%RB1.65534 | %RX1.65534.0…%RX1.65534.7 | %RW1.32767 | |
%RB1.65535 | %RX1.65535.0…%RX1.65535.7 | ||
Segment 2 | |||
%RB2.0 | %RX2.0.0…%RX2.0.7 | %RW2.0 | %RD2.0 |
%RB2.1 | %RX2.1.0…%RX2.1.7 | ||
%RB2.2 | %RX2.2.0…%RX2.2.7 | %RW2.1 | |
%RB2.3 | %RX2.3.0…%RX2.3.7 | ||
%RB2.65532 | %RX2.65532.0…%RX2.65532.7 | %RW2.32766 | %RD2.16383 |
%RB2.65533 | %RX2.65533.0…%RX2.65533.7 | ||
%RB2.65534 | %RX2.65534.0…%RX2.65534.7 | %RW2.32767 | |
%RB2.65535 | %RX2.65535.0…%RX2.65535.7 | ||
Segment 7 | |||
%RB7.0 | %RX7.0.0…%RX7.0.7 | %RW7.0 | %RD7.0 |
%RB7.1 | %RX7.1.0…%RX7.1.7 | ||
%RB7.2 | %RX7.2.0…%RX7.2.7 | %RW7.1 | |
%RB7.3 | %RX7.3.0…%RX7.3.7 | ||
%RB7.65532 | %RX7.65532.0…%RX7.65532.7 | %RW7.32766 | %RD7.16383 |
%RB7.65533 | %RX7.65533.0…%RX7.65533.7 | ||
%RB7.65534 | %RX7.65534.0…%RX7.65534.7 | %RW7.32767 | |
%RB7.65535 | %RX7.65535.0…%RX7.65535.7 | ||
Segment 15 | |||
%RB15.0 | %RX15.0.0…%RX15.0.7 | %RW15.0 | %RD15.0 |
%RB15.1 | %RX15.1.0…%RX15.1.7 | ||
%RB15.2 | %RX15.2.0…%RX15.2.7 | %RW15.1 | |
%RB15.3 | %RX15.3.0…%RX15.3.7 | ||
%RB15.65532 | %RX7.65532.0…%RX7.65532. 7 | %RW15.32766 | %RD15.16383 |
%RB15.65533 | %RX7.65533.0…%RX7.65533. 7 | ||
%RB15.65534 | %RX7.65534.0…%RX7.65534. 7 | %RW15.32767 | |
%RB15.65535 | %RX7.65535.0…%RX7.65535. 7 |
Note
Only the first 4 kB in segment 0 are available for PM57x, i.e., %RB0.0..%RB0.4095 or %RW0.0..%RW0.2047 or %RD0.0..%RD0.1023. Only the first 1 kB in segment 0 are available for PM55x and PM56x, i.e., %RB0.0..%RB0.1023 or %RW0.0..%RW0.511 or %RD0.0..%RD0.255.
Access to the %R Area Using the Modbus Protocol:
As of PLC firmware version V2.1.3 and Control Builder Plus (CBP) 2.1.0 %M area (default) or %R area can be used for access via Modbus TCP or Modbus RTU. The selection is a parameter in the Modbus server settings
With the help of the Modbus protocol, the segments 0 and 1 of the %R area can be accessed. Using this feature it is easy to access buffered data via Modbus TCP or Modbus RTU.
The chapter Modbus in this documentation contains a detailed description of the Modbus protocol and the corresponding addressing.
Note
For the AC500 CPUs PM55x and PM56x, 1kB = %RB0.0 .. %RB0.1023 (i.e., not a complete segment) are available for the addressable flag area. Thus, not all Modbus addresses can be accessed.