Data Block (Db) - Siemens SIMATIC S7 System Manual

Hide thumbs Also See for SIMATIC S7:
Table of Contents

Advertisement

By designing the FB for generic control tasks, you can reuse the FB for multiple devices by
selecting different instance DBs for different calls of the FB.
An FB stores the Input, Output, and InOut, and Static parameters in an instance DB.
Assigning the start value in the instance DB
The instance DB stores both a default value and a start value for each parameter. The start
value provides the value to be used when the FB is executed. The start value can then be
modified during the execution of your user program.
The FB interface also provides a "Default value" column that allows you to assign a new start
value for the parameter as you are writing the program code. This default value in the FB is
then transferred to the start value in the associated instance DB. If you do not assign a new
start value for a parameter in the FB interface, the default value from instance DB is copied
to start value.
Using a single FB with DBs
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.
6.3.4

Data block (DB)

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).
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05
99BProgramming concepts
6.3 Using blocks to structure your program
141

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-1200

Table of Contents