Persistent data

The Bus Terminal Controller has 1000 bytes of persistent data available.
In contrast to the retain data, these are not deleted, even with a new project, a PLC reset or a new download.

In order to use the persistent data, these must first be activated once with a function block from the PLC.

Secondly, the variables should reside in the allocated flag area. Here you can choose where the persistent data reside.
4 kbytes of allocated flags are available, of which 1000 bytes can be declared as persistent data.

Example

VAR
    Test AT %MX1000   :BOOL;
    Count AT %MB1002  :INT;
END_VAR

The Persistent_Data function block can be used to specify the start address and the length (in bytes) from which the data are to be persistent.

The input variable WriteOffset is used to specify the byte offset of the flag area, WriteSize is used for the length in bytes.

The function block can be found in the TcSystemBX.lbx library. Should this not be available, it can be downloaded from this documentation (see Libraries).

Example values

WriteOffset 1000
WriteSize 10

All data in the range %MB1000 - %MB1009 are then persistent. The variable type is irrelevant.

Like the retain data, the data are copied to the NOVRAM and are therefore writeable in each cycle.

Persistent data 1:

Persistent data from firmware 1.17

Persistent data is supported for all BX controllers from firmware 1.17 or higher.

Persistent data 2:

Parameters are valid immediately

The parameters only have to be written once, after which they are valid immediately. These data are stored permanently.
Activation of the factory setting deletes everything, including the persistent data.

Sample Program

Click on the link Persistent data 3: (Download) to download a sample program from this documentation.

persistent_data.prx