Storage Area of the S7-1200 CPU |Understanding the Internal Storage Area of the S7-1200 CPU - Hardware Overview

 The CPU module integrates various resources internally, and PLC manufacturers typically categorize the CPU of a particular model into different series based on the integrated resources. For example, Siemens S7-1200 CPU modules are divided into five series: 1211C, 1212C, 1214C, 1215C, and 1217C. Among the numerous resources, memory is an indispensable component. Today, we will discuss the internal memory/areas of the S7-1200 series CPU. The term "memory/areas" is used here because the physical division is generally referred to as memory, while the logical division is commonly termed as memory areas.





Based on the physical properties, the internal memory of the CPU module can be categorized into Random Access Memory (RAM), Read Only Memory (ROM), and Flash Memory.

"Random Access Memory," abbreviated as RAM, is characterized by fast access speed, low cost, and read-write capability. However, data cannot be preserved after power loss.

"Read Only Memory," abbreviated as ROM, allows only reading of internal data and is not writable. It retains data even after power loss and is typically used to store the PLC's operating system.

Flash Memory or Flash EPROM is characterized by read-write capability, slower access speed, non-volatility, and data retention after power loss. Flash memory is commonly used to store user programs and data. Storage cards from SIMATIC fall into this category.

For CPU 1211C, the size of the work memory is 50KB. (Note: The size may vary based on firmware versions, with 25KB for firmware version 2.0 and 30KB for firmware version 3.0). For CPU 1212C, the work memory size is 75KB. For CPU 1214C, it is 100KB; for CPU 1215C, it is 125KB; and for CPU 1217C, the work memory size is 150KB. It is important to note the module's firmware version, as lower versions may have smaller memory sizes. Additionally, the work memory size is fixed and cannot be expanded.

Retentive Memory is a non-volatile storage medium that can retain data from certain work memory areas during power loss. When power is restored, the CPU restores the saved data to its original addresses. All CPUs in the 1200 series have a retentive memory size of 10 KB.

System Memory includes the Input Process Image Area, Output Process Image Area, Bit Memory, Temporary Memory, and Data Block Memory.

During each cycle, the CPU scans the physical addresses of external devices and stores the acquired data in the Input Process Image Area. This area allows user programs to access data in bit, byte, word, or double-word formats. While read and write operations are allowed in the Input Process Image Area, it is typically used for read operations.

You can directly access the content of external devices by appending ":P" to the address, for example, "I0.3:P". This instruction directly accesses the content of the external device rather than reading data from the Input Process Image Area. CPU cannot perform write operations on external device content, so "I0.3:P" is read-only. "I0.3" accesses the CPU's Input Process Image Area, which is a copy of external device data, making it both readable and writable. Data in the Input Process Image Area can be accessed globally.

Before the end of each cycle, the CPU copies the content of the Output Process Image Area to the output modules' physical addresses. Similar to the Input Process Image Area, the Output Process Image Area allows user programs to access data in bit, byte, word, or double-word formats, and it is also readable and writable.

If you want to immediately output the result of an operation to the physical address of an external device instead of the Output Process Image Area, you can append ":P" to the address, for example, "Q0.1:P". The difference between "Q0.1" and "Q0.1:P" is that the former accesses the Output Process Image Area, while the latter directly accesses the physical output of the external device. The former is both readable and writable, while the latter only allows write operations; attempting to read will result in an error.

Bit Memory, also known as M Memory, is frequently used and supports read and write operations. Data in the M Memory can be accessed in bit, byte, word, or double-word formats, and many intermediate variables needed during program execution are stored here. Data in the M Memory can be accessed globally, and it won't be reclaimed by the system when a program block call ends. However, it's important to note that data in the M Memory cannot be preserved after a power loss unless set to retain. The system will automatically save such data to the Retentive Memory when the voltage decreases.

How to set it up? Open TIA Portal V13, locate "PLC Tags" on the left, double-click, and the contents of the tag table will appear on the right. Click the "Retain" icon, as shown in the following image:


Appearing is the dialog box for the Retentive Memory. Let's assume that we are saving 10 bytes starting from MB0, as shown in the figure below:

This way, we have configured a Retentive Memory area from MB0 to MB9, totaling 10 bytes. The corresponding "Retain" property in our variable table is now selected, as shown in the figure below.


Temporary Memory is used to store temporary variables during the execution of Function Blocks (FB) or Function Calls (FC). It is only valid during the execution of the FB or FC and will be reclaimed by the operating system once the call is completed. Data in the Temporary Memory area is locally effective, and these variables, also known as local variables, can only be accessed by the called FB. Temporary variables cannot be saved to the Retentive Memory.

Data Block Memory is used to store various data for programs and allows access in bit, byte, word, and double-word formats. Some instruction operations' required data structures are also stored in the Data Block Memory area. Data Blocks are divided into Global Data Blocks (Global DB) and Instance Data Blocks (Instance DB). Data stored in Global Data Blocks can be accessed by all code, while data in Instance Data Blocks can only be accessed by specified FBs. Data in Data Blocks has persistence and will not be reclaimed by the system after code execution.

This concludes our introduction to the CPU's internal memory/areas. In the next article, we will continue to explore other internal resources of the CPU.


Related Reference Article: Accumulators in S7-300/400 PLC |Understanding Registers and Accumulators in S7-300/400 PLC