Technical data

Table Of Contents
Copy and Block Functions
System Software for S7-300/400 System and Standard Functions - Volume 1/2
A5E00709327-01
3-23
3.12 Creating a Data Block with SFC 85 "CREA_DB"
Description
With SFC 85 "CREA_DB" (create data block) you create a data block with no
default values in the user program. Instead, the DB contains random data. The
SFC creates a data block with a number from a specified area and with a default
size. The SFC assigns the smallest possible number from this area to the DB. To
create a DB with a specific number, enter the same number for the upper and
lower limits of the default area. You cannot issue the numbers from the DBs
already continued in the user program. The length of the DB must be specified with
an even number.
Depending on the selection made for the ATTRIB parameter, the DB created has
the property RETAIN or NON_RETAIN:
RETAIN means that the DB is created in the retentive part of the work memory.
This means the current values of the DB are retained after each power
OFF/power ON transition and every restart (warm restart).
NON_RETAIN means that the DB is created in the non-retentive part of the
work memory. This means the current values of the DB are undefined after
each power OFF/power ON transition and every restart (warm restart).
If no distinction is made between retentive and non-retentive work memory, the
ATTRIB parameter is ignored. This means the values of the DB are retained after
each power OFF/power ON transition and every restart (warm restart).
Interruptability
SFC 85 "CREA_DB" can be interrupted by higher-priority OBs. If SFC 85
"CREA_DB" is again called in a higher-priority OB, this call is rejected with the
error code W#16#8091.
Parameter Declaration Data
Type
Memory
area
Description
LOW_LIMIT INPUT WORD I, Q, M, D, L
constant
The lower limit value is the lowest number
in the range of numbers that you can assign
to your data block.
UP_LIMIT INPUT WORD I, Q, M, D, L
constant
The upper limit value is the highest number
in the range of numbers that you can assign
to your data block.
COUNT INPUT WORD I, Q, M, D, L
constant
The count value indicates the number of
data bytes that you want to reserve for your
data block. You must specify an even
number of bytes (maximum 65534).
ATTRIB INPUT BYTE I, Q, M, D, L
constant
DB attributes:
B#16#00: RETAIN
B#16#04: NON_RETAIN
RET_VAL OUTPUT INT I, Q, M, D, L If an error occurs during processing, the
function, the return value contains an error
code.
DB_NUMBER OUTPUT WORD I, Q, M, D, L The data block number is the number of the
created data block. In case of an error, (bit
15 for RET_VAL was set) the value of 0 is
entered in DB_NUMBER.