This entry describes the memory concept for SIMATIC S7-400 CPUs and for SIMATIC S7-318 CPUs. This is illustrated once again by a diagram at the bottom of the entry.
The memory in SIMATIC S7-400/S7-318 CPUs can be written to via the following 3 areas: load memory, main memory and system memory.
- Load memory:
The load memory can be divided into the external and the internal load memories. The internal load memory is a RAM memory which is integrated into the CPU. Blocks can be transferred from the programming device (PG) to the load memory in the CPU with "PLC/Load". The main memory is updated here at the same time, whereby the runtime-relevant code and data blocks are transferred to the main memory.
The load memory can be extended via a RAM memory card or a flash memory card. The memory card then acts as the external load memory.
If you have a flash memory card plugged in, transfer blocks to the external load memory with "PLC >Load user program onto memory card". However, in the case of "PLC >Load user program onto memory card", the CPU has to be set to STOP mode first before the user program can be transferred.
If you have a RAM memory card inserted, the program can be transferred to the CPU via "PLC > Load". The main memory is also updated here at the same time, whereby the runtime-relevant code and data blocks are transferred to the main memory. The internal RAM load memory is filled first. The other blocks are only written to the RAM memory card when it is full.
All the program blocks and data blocks can be loaded into the load memory via the programming device (PG).
- Expanding the load memory with a memory card:
The following points determine the decision on which memory card to use:
Do you wish to retain the user program on the memory card when the power is OFF and without a back-up battery? If so, this would necessitate the use of a flash memory card.
If you use a flash memory card without back-up batteries, the blocks in the RAM part of the load memory and the data (main memory and system memory) will be lost when the power is OFF.
Do you wish to be able to change the user program in RUN mode, and is the program too big for the internal RAM? If so, this would necessitate the use of a RAM memory card. When using a RAM memory card, the system must be battery-operated so as to back up the RAM memory card data and the data in the internal RAM if there is a power failure.
- If you have a memory card inserted, the operating system asks for a overall reset (STOP LED flashes slowly at 0.5 Hz). You can initiate the reset procedure as follows: Move the switch to MRES position and then back to STOP again. The STOP LED then flashes for at least 3 seconds at a rate of 2 Hz (overall reset is performed) and, after that, lights up permanently. If you have a flash memory card inserted, following the overall reset the CPU copies the user program and the saved system parameters from the flash memory card to the main memory.
The memory card must remain inserted while the program is being processed. If you insert or remove the memory card while the power is ON, the CPU asks for an overall reset whereby the STOP LED flashes slowly at 0.5 Hz. If you insert or remove the memory card while the power is OFF, the CPU performs an overall reset automatically after being switched back on.
- Main memory:
The main memory is divided into two parts. One of the parts is used for the runtime-relevant code. The process input image (PII), the process output image (POI) and the diagnostics buffer are also saved in the main memory for the code. The other part of the main memory is used for the runtime-relevant data and also contains the data from the local data stack. The main memory is a battery-backed RAM.
If you change the division of the main memory by means of parameter assignment in "HW Config > Object properties > ...", the main memory is reorganized when the system data is loaded into the CPU. As a result, data blocks which have been generated by SFC are deleted, and the other data blocks are preset with initial values from the load memory. The portion of the main memory which can be used for code or data blocks is changed when the system data is loaded whenever you change the following parameters:
- Size of the process image (in bytes; in the "Cycle/Clock marker" tab)
- Communication resources (in the "Memory" tab)
- Size of the diagnostics buffer (in the "Diagnostics/Clock" tab)
- Quantity of local data for all priority classes ("Memory" tab)
If you change the system data, you need to allow for the following storage requirements during parameter assignment:
||Main memory required
||In the code/data memory|
|Size of the process image
|12 bytes per byte in the process input image
|Size of the process image
|12 bytes per byte in the process output image
|72 bytes per communication job
|Size of the diagnostics buffer
||32 bytes per entry in the diagnostics buffer
|Quantity of local data
||1 byte per byte of local data in the data memory
- System memory:
The system memory (RAM) contains the memory elements which any CPU makes available to the CPU, such as markers (M), times (T) and counters (Z). Moreover, the system memory also contains the block stack and the interrupt stack. There is also temporary memory capacity in the CPU's system memory reserved for the local data stack, for the diagnostics buffer and for communication resources. This data in the system memory's temporary memory only remains valid while the block is active. Once the block has been closed, the data is no longer retained in the main memory (temporary local data).
Program processing takes place exclusively in the area of the main memory and system memory.
How the CPU behaves after POWER ON
After the power is switched ON, a check is performed first to determine whether or not the power supply is backed up.
If POWER ON is backed up, the system performs the start-up mode (re-start, new start, cold start) which is selected in the CPU properties/Start-up in the hardware configuration.
If POWER On is not backed up and there is a flash memory card inserted, the runtime-relevant code and data blocks are transferred from the load memory to the main memory.
The memory concept for the SIMATIC CPU 318-2DP is similar to that for the SIMATIC S7-400 CPUs.
Further information and notes
- Further information about the data for the individual CPUs can be found in the manual "Automation System S7-400 Setup and Use", Chap. 2.2 Entry ID 22586851
- Further information about the acceleration properties/behavior (cold start, warm start, ...) can be found in the manual "Automation System S7-400 CPU Data", Chap. 4.2 Entry ID 14016796
- Notes about the different types of memory cards can be found in "Automation System S7-400 CPU Data", Chap. 1.5 Entry ID 14016796
- Notes on resetting the CPU can be found in the manual "Automation System S7-400 Setup", Chap. 6.5 Entry ID 1117849
- Notes about the behavior of the CPU after POWER OFF without a back-up battery can be found in Entry ID 1994237
CPU selection, Memory cards