Data Blocks Provide Easy Storage For Program Data - Siemens SIMATIC S7-1200 Manual

Hide thumbs Also See for SIMATIC S7-1200:
Table of Contents

Advertisement

The following figure shows an OB that calls one FB three times, using a different data block
for each call. This structure allows one generic FB to control several similar devices, such as
motors, by assigning a different instance data block for each call for the different devices.
Each instance DB stores the data (such as speed, ramp-up time, and total operating time)
for an individual device. In this example, FB 22 controls three separate devices, with DB 201
storing the operational data for the first device, DB 202 storing the operational data for the
second device, and DB 203 storing the operational data for the third device.
5.2.3

Data blocks provide easy storage for program data

You create data blocks (DB) in your user program to store data for the code blocks. All of the
program blocks in the user program can access the data in a global DB, but an instance DB
stores data for a specific function block (FB).
Your user program can store data in the specialized memory areas of the CPU, such as for
the inputs (I), outputs (Q), and bit memory (M). In addition, you can use a data block (DB) for
fast access to data stored within the program itself. You can define a DB as being read-only.
The data stored in a DB is not deleted when the data block is closed or the execution of the
associated code block comes to an end. There are two types of DBs:
● A global DB stores data for the code blocks in your program. Any OB, FB, or FC can
● An instance DB stores the data for a specific FB. The structure of the data in an instance
Although the instance DB reflects the data for a specific FB, any code block can access the
data in an instance DB.
Easy Book
Manual, 11/2009, A5E02486774-01
access the data in a global DB.
DB reflects the parameters (Input, Output, and InOut) and the static data for the FB. The
Temp memory for the FB is not stored in the instance DB.
Programming concepts made easy
5.2 Easy to design your user program
53

Advertisement

Table of Contents
loading

Table of Contents