# How to save a variable value after controller power off inquiry

**URL:** <https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533>\
**Category:** Programming\
**Created:** [December 30, 2025, 7:14am UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533 "2025-12-30T07:14:36Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![evgeni.kecher](https://avatars.discourse-cdn.com/v4/letter/e/FF8800/32.png) [@evgeni.kecher](https://community.br-automation.com/u/evgeni.kecher)\
**Post date:** [December 30, 2025, 7:14am UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/1 "2025-12-30T07:14:36Z")

</div>

Hello,

I need to save a variable after power off or any other reset of the controller.

I configured the variable as RETAIN (global var, INT type) using the checkbox, but it does not work (no error, the value is being reset after any shutdown/reset).

I tried to test the same controller(5APC2100\_BY01\_000) in the lab and it does not work as well: once I turn OFF and ON the controller the value is reset to 0.

Can someone advice a solution ?

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/b/b56e0f899c5824243576276ccf5e89cccf9e5c14.png)

![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/8/8bc91fbabff673ff37f09bb205ec33a801eeedf0.png)

---

<div class="post-metadata">

**Author:** ![corne.geerts](https://avatars.discourse-cdn.com/v4/letter/c/FF8800/32.png) [@corne.geerts](https://community.br-automation.com/u/corne.geerts)\
**Post date:** [December 30, 2025, 7:23am UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/2 "2025-12-30T07:23:35Z")

</div>

What is the setting in CPU configuration Reboot mode after powerfail:

![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/f/faf8c174c29d28e76fa8384108f9c06f844b33ca.png)

It should be on warm start.

Are there any errors like 26263 in the logbook?

If so, try hardening measures, see following link:

[Hardening measures](https://help.br-automation.com/#/en/4/automationruntime%2Ftargets%2Fsg4_gen%2Fremanentedaten%2Frem_error.html)

Do you already use the latest AR 4.83 version I4.83?

---

<div class="post-metadata">

**Author:** ![evgeni.kecher](https://avatars.discourse-cdn.com/v4/letter/e/FF8800/32.png) [@evgeni.kecher](https://community.br-automation.com/u/evgeni.kecher)\
**Post date:** [December 30, 2025, 8:03am UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/3 "2025-12-30T08:03:32Z")

</div>

thanks for answering.

No errors in the logbook.

The configuration of the reboot is correct, as below.

![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/a/ab3364e2ec8627dc656feda6318e31c7214b3cc0.png)

regarding the AR version, please advise where shall I check what AR is being used?

---

<div class="post-metadata">

**Author:** ![marcusbnr](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcusbnr/32/256_2.png) [@marcusbnr](https://community.br-automation.com/u/marcusbnr)\
**Post date:** [December 30, 2025, 1:15pm UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/4 "2025-12-30T13:15:30Z")

</div>

One other thing to check - is it possible that the variables you’ve retained are getting a new value before you check them? For example, if you assign a variable a value in the INIT routine, that will overwrite whatever retained value it had on boot.

Also, you can check your AR version in Project → Change Runtime Versions in Automation Studio.

---

<div class="post-metadata">

**Author:** ![evgeni.kecher](https://avatars.discourse-cdn.com/v4/letter/e/FF8800/32.png) [@evgeni.kecher](https://community.br-automation.com/u/evgeni.kecher)\
**Post date:** [January 4, 2026, 1:20pm UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/5 "2026-01-04T13:20:07Z")

</div>

thanks for replying.

it works properly in case of a power shut down: The value is being saved if we power off and then power on the PLC.

the problem that we face is that the value is not saved after cold reset.

Does the value shall be saved after cold reset or the PLC HW is designed to set the default value after cold reset?

---

<div class="post-metadata">

**Author:** ![valerio.manenti](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/valerio.manenti/32/11712_2.png) [@valerio.manenti](https://community.br-automation.com/u/valerio.manenti)\
**Post date:** [January 4, 2026, 9:31pm UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/6 "2026-01-04T21:31:01Z")

</div>

In this case @evgeni.kecher you need permanent variables:

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/6c62d77ab75c14f433ad28c46cf4471b0fd5bfa9.png)  
I see 3 useful pages in the help under “Nonvolatile variables“ section:

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/1/157a7eb3e791e315a2d20d7f5104b8c26e1c635f.png)

Last note: “Permanent variables are not supported on all target systems.“

Ciao  
Valerio

---

<div class="post-metadata">

**Author:** ![evgeni.kecher](https://avatars.discourse-cdn.com/v4/letter/e/FF8800/32.png) [@evgeni.kecher](https://community.br-automation.com/u/evgeni.kecher)\
**Post date:** [January 5, 2026, 8:50am UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/7 "2026-01-05T08:50:27Z")

</div>

I did not find a list on what HW is supported.

“Permanent variables” are supported in 5APC2100?

I declared it in the globles variables but it does not compile. I do not see an example of how to implement it, can you provide ?

---

<div class="post-metadata">

**Author:** ![michael.bertsch](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/michael.bertsch/32/239_2.png) [@michael.bertsch](https://community.br-automation.com/u/michael.bertsch)\
**Post date:** [January 5, 2026, 9:46am UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/8 "2026-01-05T09:46:08Z")

</div>

Hello,

In order to configure a permanent Variable it has first to be selected as retain Variable.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/3/31d53250971713e14ab425a8487c6c191f54ab8e.png)

Then you can go to the Hardware Configuration of the PLC and check if the menü shows you the Editor for Permanent Variables (for APC2100 this is available)  
Here you an add the Variable to the list and set up the fixed Offsets in Memory.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/2/255d7e09a86b149210a77ee94865eacf981bb903.png)

There is also an Button to calculate the Offsets automaticaly.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/2/2848c6b0b0f75269db052d7299a50f58586847c0.png)

It is also important to set up the memory configuration.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/600e67722e61ece0289c72782bb0930043ea7628.png)

Please not that the system of permanent Variables has been discontinued and all new B&R PLCs will only support Retain Variables.

Greetings  
Michael

---

<div class="post-metadata">

**Author:** ![marcusbnr](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/marcusbnr/32/256_2.png) [@marcusbnr](https://community.br-automation.com/u/marcusbnr)\
**Post date:** [January 5, 2026, 1:53pm UTC](https://community.br-automation.com/t/how-to-save-a-variable-value-after-controller-power-off-inquiry/9533/9 "2026-01-05T13:53:41Z")

</div>

If your controller doesn’t support permanent variables, another option is to save the variables to the hard disk (CFast card). In my opinion, this is a good thing to do anyway because it ensures that the data persists on the memory card even if there is a cold start or the controller ever stops working.

The easiest way to do this is with [mapp Recipe](https://help.br-automation.com/#/en/4/mapptechnology%2Fmapp_services%2Fmprecipe%2Fmprecipe.html), which saves the variables you choose to a CSV or XML file. If you didn’t want to pay for the mapp Services license, you could also make your own solution by creating the CSV or XML file manually. You would then write the data to a file whenever it changes (or just before a cold start if you can predict that) and then read it again at startup. As a bonus, this file can be transferred to a different controller if you wanted to easily transfer the saved data to another machine. This is the method I use to save machine settings and configuration options in my projects and it works well. The only caveat is that these settings don’t change very often. If your variables are actively changing every cycle, you won’t want to write to the memory card that often.
