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.

  1. Copy the data from the %R area and write it to the CPU’s RAM disk as file

  2. Save the file to the SD Card.

  1. Load the file from the SD Card to the CPU’s RAM disk.

  2. 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