How the S7-1200 works
4.3 Memory areas, addressing and data types
Easy Book
Manual, 05/2009, A5E02486774-01
35
Memory areas and addressing
The CPU provides several options for storing data during the execution of the user program:
●
Memory locations: The CPU provides a variety of specialized memory areas, including
inputs (I), outputs (Q), bit memory (M), data block (DB), and local or temporary memory
(L). Your user program accesses (reads from and writes to) the data stored in these
memory areas.
●
Data block (DB): You can include DBs in your user program to store data for the code
blocks. The data stored in a DB is not deleted when the data block is closed or when the
execution of the associated code block comes to an end. There are two categories of
DBs. A global DB stores data that can be used by all other blocks, and an instance DB
stores data for a specific function block (FB). The parameters of the FB provide the
structure for the instance DB.
●
Temp memory: Whenever a code block is called, the operating system of the CPU
allocates the temporary, or local, memory (L) to be used during the execution of the
block. When the execution of the code block finishes, the CPU reallocates the local
memory for the execution of other code blocks.
●
References to the input (I) or output (Q) memory areas, such as I0.3 or Q1.7, access the
process image. To immediately access the physical input or output, append the reference
with ":P" (such as I0.3:P, Q1.7:P, or "Stop:P").
Each different memory location has a unique address. Your user program uses these
addresses to access the information in the memory location.
Memory area
Description
Force
Retentive
Copied from physical inputs at the
beginning of the scan cycle
No
No
I
Process image input
I_:P
(Physical input)
Immediate read of the physical input
points on the CPU, SB, and SM
Yes
No
Copied to physical outputs at the
beginning of the scan cycle
No
No
Q
Process image output
Q_:P
(Physical output)
Immediate write to the physical output
points on the CPU, SB, and SM
Yes
No
M
Bit memory
Control and data memory
No
Yes
(optional)
L
Temp memory
Temporary data for a block local to that
block
No
No
DB
Data block
Data memory and also parameter memory
for FBs
No
Yes
(optional)
STEP 7 Basic facilitates symbolic programming. Typically, tags are created either in PLC
tags, a data block, or in the interface at the top of an OB, FC, or FB. These tags include a
name, data type, offset, and comment. Additionally, in a data block, an initial value can be
specified. You can use these tags when programming by entering the tag name at the
instruction parameter. Optionally you can enter the absolute operand (memory, area, size
and offset) in the parameter field of the instruction.
To immediately access the physical inputs and physical outputs, append a ":P" to the
address or tag (such as I0.3:P, Q1.7:P, or "Stop:P").