1-second UPS (persistent variables)

1-second UPS (persistent variables) 1:

Loss of data

Use only TwinCAT to control the 1-second UPS and save only persistent data with a maximum size of 1 MB. Use beyond this may result in data loss or corrupt data.

The 1-second UPS is an UltraCap capacitor that continues to supply the processor with power in the event of a power failure. During this period persistent data can be saved, which are available on switching on again.

1-second UPS (persistent variables) 2:
Behavior of systems in the event of a power failure without and with a 1-second UPS.

Since the 1-second UPS is designed for the entire service life, the holding time is considerably longer with new devices. The capacitors age over the course of time and the holding time decreases. Therefore a maximum of 1 MB persistent data can be reliably saved over the entire service life. Do not save any other data and do not use any other applications to control the 1-second UPS.

Please note that the 1-second UPS does not supply power to the K-bus or the E-bus and that their data may already be invalid when the 1-second UPS is activated. Also, the fieldbus system (or Ethernet) may not work or not work properly once the 1-second UPS was activated.

Storage location and names of the files in TwinCAT 3.

Development environment

File path

File name

TwinCAT 3

\\TwinCat\3.1\Boot\Plc

Port_85x.bootdata
Port_85x.bootdata-old (backup)

The x in the file name stands for the number of the runtime system.

Configuration of the 1-second UPS

Sample project:
ups_example.pro.

Saving and loading persistent data

The persistent data are saved in the Port_85x.bootdata file on the memory card. On starting the PLC the Port_85x.bootdata file is loaded from the memory card, backed up there as Port_85x.bootdata_old (backup) and then deleted.

Another current Port_85x.bootdata file is not written until the system is shut down or the 1-second UPS is activated.

If no Port_85x.bootdata file exists when starting the embedded PC, the persistent data are invalid and will be deleted (standard setting). The reason for this is that the 1-second UPS was activated before the TwinCAT PLC was started during startup of the embedded PC. In this case no persistent data were saved, since the system was unable to ensure sufficient buffer time for saving the data.

Always call the function block from the PLC and always use the fastest task to do so. In the case of a power failure Beckhoff recommends not calling the rest of the application in order to ensure that sufficient time remains for writing the data.

IF NOT FB_S_UPS_BAPI.bPowerFailDetect THEN
    ;//Call programs and function blocks
END_IF

The rest of the application influences the CPU load and the CPU load in turn affects the period during which the persistent data are written.

Loading a backup of the persistent data

A registry setting can be used to determine whether the backup file is deleted or used. The backup file is used by default (setting 0):

[HKEY_LOCAL_MACHINE\SOFTWARE\Beckhoff\TwinCAT\Plc]"ClearInvalidPersistentData"= 0

If the backup file is to be deleted, the value of "ClearInvalidPersistentData" in the registry must be set to 1.

It is also possible in TwinCAT to specify on the left in the tree view under PLC whether the backup file is to be used or not.

1-second UPS (persistent variables) 3:
Loading a backup of the persistent data. Settings in TwinCAT 3.

The backup files will be deleted if the option Clear Invalid Persistent Data is activated. Corresponds to registry entry 1.