Understand Start Value and Retentive Memory in S7-1500 PLCs

Jun 28, 2025 min read

Introduction

At different stages of our career we will encounter situations that the PLC undesirably “lose” the data that we want to retain. When such a situation happens, people will start to talk about using retentive memory and some people will start to voice concerns about the start values.

Retentive memory and start values are quite nuanced concepts that advanced control software engineers must understand. Let’s have a look together.

What are the S7 PLC memory

The S7 PLCs have a few different memories. The below picture gives a very straight forward explanation of the different memory types.

PLCMemories

An easy way to understand the concepts is load memory is the hard drive and work memory is the RAM of a computer. Retentive memory and other memory areas are special in the S7 PLCs and our focus is the retentive memory.

Understand Retentive Memory of S7 PLCs

Retentive memory is a special memory that can be used the same way of the work memory but can store data in the event of a power failure.

Apart from the data that we choose to store in the retentive memory, specific tags of technology objects are also stored in the retentive memory, for example the calibration of an encoder.

Though retentive memory can retain data, it is not bulletproof. When the below scenarios happen, the retentive memory will lose its values:

  • Factory reset
  • Memory reset
    • Automatic memory reset
      • The user program is too large and cannot be loaded to the work memory in full.
      • The project data on the SIMATIC memory card are damaged, for example because a file was deleted.
      • You remove or insert the SIMATIC memory card. The backed-up retentive data differs in structure from the data in the configuration on the SIMATIC memory card.
    • Manual memory reset
      • Using the mode selector / mode selector keys
      • Using the display
      • Using STEP 7
      • Using user program

If any of the above scenarios happened, what value will the PLC tags have? Yes, the start value.

Understand Start Values

The start value of a tag is an user defined value that the tag will assume when the PLC starts up.

If the tag is retentive, during PLC startup the tag will maintain its value from the last value assignment instead of the start value even though there is one configured.

Below is a demonstration that can help with understanding the concepts.

A Quick Demonstration

In this demonstration, I have a global DB that contains two integer tags. TestTags1 is retentive and has a start value of 80. TestTag2 is non-retentive and has a start value of 50.

The current values of TestTags1 and TestTag2 are 180 and 150 respectively.

Demonstration1

If I restart the CPU, here’s the tag values.

Demonstration2

TestTags1 is retentive so it retains the value of 180. TestTag2 is non-retentive so it grabs its start value which is 50.

Now, if I restore TestTag2 with a current value of 150 and restart the PLC again with the command INIT_RD() in the PLC startup OB100, the tag values are below.

Callmemoryreset

Demonstration3

INIT_RD() command can only be used in the startup OB and it will trigger a memory reset. As we understand previously, when a memory reset happens, the PLC tags will load their start value instead of the retained value hence TestTags1 and TestTag2 have 80 and 50 after the PLC restart.

FB Interface Setting Special Case

While declaring a function block’s interface, apart from the option to declare the interface variable (most likely the static tags) as retain or non-retain, a third option is “set in IDB”. If we use this option, then for each FB instance, we need to set the retain option in its instance DB and by default they are non-retain.

Conclusion

If a tag is put in the retentive memory, it will normally retain its value unless an automatic or manual memory reset happens. If a memory reset happens, regardless if a tag is in retentive memory or not, it will assume the start value.