×
Siemens Industry Online Support
Siemens AG
Entry type: FAQ Entry ID: 291495, Entry date: 07/28/2021
(1)
Rate

How are the variables stored in the temporary local data?

  • Entry
  • Associated product(s)
In the following we explain the local data addressing with S7-300/S7-400.

Description
The L-stack addressing always starts at address "0". For each block, bytes are reserved on the L-stack, which corresponds to the amount of static data and/or local data. When a block is terminated, its area is released again.

The pointer always points to the first byte of the currently opened block. The following table shows an example:
 

Runtime level  L stack
in bytes 
Pointer 
 
Call OB1 (with 20 static [fixed] and 10 additional local data)
300
 
Call FC1 (with 30 local data) 30 bytes (OB1) +30 bytes (FC1)
6030
 Call FC10 (with 20 local data)
60 bytes (OB1 + FC1) +20 bytes FC10
8060
 Call FC11 (with 20 local data)
60 bytes (OB1 + FC1) +20 bytes FC11
8060
 Call FC12 (with 30 local data)
60 bytes (OB1 + FC1) +30 bytes FC12
9060

Call FC2 (with 50 local data)
30 bytes (OB1) +50 bytes (FC2)
8030

Call FC20 (with 10 local data)
80 bytes (OB1 + FC2) +10 bytes FC20
9080
 
Call FC21 (with 10 local data)
80 bytes (OB1 + FC2) +10 bytes FC21
9080
 
Call FC22 (with 20 local data)
80 bytes (OB1 + FC2) +20 bytes FC22
10080
 Call FC221 (with 10 local data)
100 bytes (OB1 + FC2 + FC22) + 10 bytes FC221
11080


The L stack is used by the CPU for internal processing. The STL editor itself also uses local data, for example for the parameter transfer during a block call. This is why you should not change the contents of the L stack.

The local data size was changed in the firmware V3.x and higher (new hardware) for all S7-300 CPUs and increased to 32 KB per process level, for example. More detailed information is available in the technical data of each CPU.

Example:
For the CPU 319-3 PN/DP, 2MB, 6ES7318-3EL01-0AB0 in the technical data under "Data areas and their retentivity" you will find the information about the local data:

  • Per priority class, max. 32768 bytes; max. 2048 bytes per block

Note
With the S7-400, 256 bytes per priority class are provided for each program processing level (runtime level), which you may set in the CPU properties of the hardware configuration.

Rate entry
no rating
Requests and feedback
What do you want to do?
Note: The feedback always relates to the current entry / product. Your message will be forwarded to our technical editors working in the Online Support. In a few days, you will receive a response if your feedback requires one. If we have no further questions, you will not hear from us.