Backup and Restore Data

Horner Automation Group Europe > Blog > Tech Tips > Backup and Restore Data


The Fail-Safe System is a set of features that allow an application to continue running in the event of certain types of “soft” failures. These “soft” failures include:

  • Battery power loss
  • Battery-Backed Register RAM or Application Flash corruption due to, for example, an excessive EMI event.

The Fail-Safe System has the following capabilities:

  • Manually backup the current Battery-Backed RAM Register Settings into Flash memory.
  • Manually restore Register Settings from the values previously backed up in Flash to BatteryBacked RAM.
  • Detect corrupted Register Settings at power-up and then automatically restore them from Flash.
  • Detect corrupted or empty application in Flash memory at power-up and then automatically load the AUTOLOAD.PGM application file from Removable Media (Compact Flash or MicroSD).
  • If an automatic Register Restore or Application Load occurs, the OCS can automatically be placed in RUN mode

The fail-safe system can be accessed by going to the system menu of the controller. A new menu “FailSafe System” has been added at the end of the main system menu for this. Selecting “Fail-Safe System” menu will open the following menu screen:


To use the fail – safe feature, the user needs to do the following:

  1. Backup the current Battery-Backed RAM Register contents in On-Board Flash memory using System Menu options.
  2. From Cscape, create AUTOLOAD.PGM for the application program using ‘Export to Removable Media’.
  3. Place the Removable Media with AUTOLOAD.PGM in the device.
  4. Set the ‘Enable AutoLoad’ option in the device to YES.
  5. Set the ‘Enable AutoRun’ option to YES if the controller needs to be placed in RUN mode automatically after automatic restore of data or AutoLoad operation.

Backup / Restore Data

Selecting this option brings up a screen having four operations:

  • Backup OCS Data.
  • Restore OCS Data.
  • Clear Backup Data.
  • Exit

Backup OCS Data:

When initiated, this will allow the user to manually copy Battery-Backed RAM contents on to the onboard FLASH memory of the OCS. This will have the effect of backing up all the registers and controller settings (Network ID, etc.) that would otherwise be lost due to a battery failure. %SR164.4 is set to 1 when backup operation is performed.

Restore OCS Data:

When initiated, this will allow the user to manually copy the backed up data from the onboard FLASH to the Battery-Backed RAM. A restore operation will be automatically initiated if a backup has been previously created and on power-up the Battery-Backed RAM registers fail their check. The following process will be followed for restoring data:

  • The controller will be placed in IDLE mode.
  • Data will be copied from onboard FLASH to OCS Battery-Backed RAM
  • The controller will reset.
  • The controller will be put in RUN mode if the AutoRun setting is ‘Yes’ else it will remain in IDLE mode.

%SR164.3 is set to 1 only when an automatic restore operation is performed – not on a manual one. This bit is reset to 0 when a new backup is created.

Restoring of data can be manually performed by selecting RESTORE option from the Backup / Restore Data menu. This will cause the controller to reset.

Clear Backup Data:

When initiated, the backup data will be erased from the onboard Flash and no backup will exist. %SR164.4 and %SR164.3 is reset to 0 when backed up data is erased.

Exit: Goes back to the previous screen.

The OCS follows the following sequence in execution of Automatic Restore: