Siemens SIMATIC S5-115U User Manual page 235

Simatic s5 series cpu 941-7ub11 cpu 942-7ub11 cpu 943-7ub11 and cpu 943-7ub21 cpu 944-7ub11 and cpu 944-7ub21
Table of Contents

Advertisement

S5-115U Manual
Call a Data Block "C DB"
Data blocks are always called unconditionally. All data processed following the call refers to the
data block that has been called. This operation cannot generate new data blocks. Blocks that are
called must be programmed before program scanning.
Example: Program block PB3 needs information that has been programmed as data word DW 1
in data block DB10. Other data, e.g., the result of an arithmetic operation, is stored as
data word DW 3 in data block DB20.
Program Sequence
PB3
C DB10
L DW 1
C DB20
T DW 3
Generating and Deleting a Data Block
The "G DB x" statement does not call a data block. Instead, it generates a new block. If you want
to use the data in this data block, call it with the "C DB" statement.
Before the "G DB" statement, indicate in ACCUM 1 the number of data words the block is to have
(see the example below).
If you specify zero as the data block length, the data block in question is deleted, i.e., it is removed
from the address list. It is considered nonexistent (see 11.1.4 and 11.1.5).
Note
The block is retained as a "dead" block until the PLC memory is compressed (see
Section 7.5.3).
If an already existing data block is to be set up, the statement G DBx will have no effect! If the DB
to be set up is longer than the available memory, the CPU goes to STOP with "TRAF" or jumps to
the relevant error response OB.
The length of data blocks set up in this way is optional. However, please note that programmers
can process blocks of limited length only.
EWA 4NEB 811 6130-02b
STL
DB10
C DB10
DW 1
L DW 1
.
.
.
.
DB20
C DB20
T DW 3
DW 3
STEP 5 Operations
Explanation
The information from data word
DW 1 in data block DB 10 is loaded
into the accumulator. The contents of
ACCUM 1 are stored in data word
DW 3 of data block DB20.
8-35

Advertisement

Table of Contents
loading

Table of Contents