You are on page 1of 2

SIMATIC S7 S7-1200 Programmable controller

CPU memory

CPU memory

Memory management
The CPU provides the following memory areas to store the user program, data, and
configuration:
• Load memory is non-volatile storage for the user program, data and configuration. When you
download a project to the CPU, the CPU first stores the program in the Load memory area. This area
is located either in a memory card (if present) or in the CPU. The CPU maintains this non-volatile
memory area through a power loss. The memory card supports a larger storage space than that
built-in to the CPU.

• Work memory is volatile storage for some elements of the user project while executing the user
program. The CPU copies some elements of the project from load memory into work memory. This
volatile area is lost when power is removed, and is restored by the CPU when power is restored.

• Retentive memory is non-volatile storage for a limited quantity of work memory values. The CPU
uses the retentive memory area to store the values of selected user memory locations during power
loss. When a power down or power loss occurs, the CPU restores these retentive values upon power
up.

To display the memory usage for a compiled program block, right-click the block in the "Program
blocks" folder in the STEP 7 project tree and select "Resources" from the context menu. The
Compiliation properties display the load memory and work memory for the compiled block.
To display the memory usage for the online CPU, double-click "Online and diagnostics" in
STEP 7, expand "Diagnostics", and select "Memory".

Retentive memory
You can avoid data loss after power failure by marking certain data as retentive. The CPU
allows you to configure the following data as retentive:
• Bit memory (M): You can define the size of retentive memory for bit memory in the PLC tag table or
in the assignment list. Retentive bit memory always starts at MB0 and runs consecutively up through
a specified number of bytes. Specify this value from the PLC tag table or in the assignment list by
clicking the "Retain" toolbar icon. Enter the number of M bytes to retain starting at MB0.
Note: For any block, you can display the assignment list by selecting a block in the Program Blocks
folder and then selecting he Tools > Assignment list menu command.

• Tags of a function block (FB): If an FB was created with "Optimized" selected, then the interface
editor for this FB includes a "Retain" column. In this column, you can select either "Retentive", "Non-
retentive", or "Set in IDB" individually for each tag. An instance DB that was created when this FB
is placed in the program editor shows this retain column as well. You can only change the retentive
state of a tag from within the instance DB interface editor if you selected "Set in IDB" (Set in instance
data block) in the Retain selection for the tag in the optimized FB.
If an FB was created with "Standard - compatible with S7-300/400" selected, then the interface editor
for this FB does not include a "Retain" column. An instance DB created when this FB is inserted in
the program editor shows a "Retain" column which is available for edit. In this case, selecting the
"Retain" option for any tag results in all tags being selected. Similarly, deselecting the option for any
tag results in all tags being deselected. For an FB that was configured to be "Standard - compatible
with S7-300/400", you can change the retentive state from within the instance DB editor, but all tags
are set to the same retentive state together.

This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims
all liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties. The complete
documentation can be found at:
/dokumentation/default.aspx?DocVersionId=73837491339&Language=en-US&TopicId=70447187595 1/19/2017
SIMATIC S7 S7-1200 Programmable controller
CPU memory

After you create the FB, you cannot change the option for "Standard - compatible with S7-300/400".
You can only select this option when you create the FB. To determine whether an existing FB was
configured for "Optimized" or "Standard - compatible with S7-300/400", right-click the FB in the
Project tree, select "Properties", and then select "Attributes". The check box "Optimized block
access" when selected shows you whether a block is optimized. Otherwise, it is standard and
compatible with S7-300/400 CPUs.

• Tags of a global data block: The behavior of a global DB with regard to retentive state assignment
is similar to that of an FB. Depending on the block access setting you can define the retentive state
either for individual tags or for all tags of a global data block.

― If you select "Optimized" when you create the DB, you can set the retentive state for each
individual tag.

― If you select "Standard - compatible with S7-300/400" when you create the DB, the retentive-
state setting applies to all tags of the DB; either all tags are retentive or no tag is retentive.

The CPU supports a total of 10240 bytes of retentive data. To see how much is available, from
the PLC tag table or the assignment list, click the "Retain" toolbar icon. Although this is where
the retentive range is specified for M memory, the second row indicates the total remaining
memory available for M and DB combined. Note that for this value to be accurate, you must
compile all data blocks with retentive tags.

Note
Downloading a program does not clear or make any changes to existing values in retentive
memory. If you want to clear retentive memory before a download, then reset your CPU to
factory settings prior to downloading the program.

This document constitutes a free excerpt compiled by the user himself/herself from the documentation provided by Siemens for this product. Siemens disclaims
all liability for the completeness of this document. It shall only be used for the user's own internal purposes. It shall not be passed on to third parties. The complete
documentation can be found at:
/dokumentation/default.aspx?DocVersionId=73837491339&Language=en-US&TopicId=70447187595 1/19/2017

You might also like