Siemens SIMATIC S5 Manual page 152

Hide thumbs Also See for SIMATIC S5:
Table of Contents

Advertisement

STEP 5 Operations
Figure 3-10 shows how the contents of a data word determine the parameter of the next
statement.
DB6
DW 12
KH=0108
DW 13
KH=0001
The following example illustrates how new parameters are generated in every program scan.
Example
Set the contents of data words
DW20 to DW100 to signal
state "0". The index register
for the parameter for the data
words is DW1.
3-56
FB x
:C
DB
.
.
.
:DO DW
:A
F
:DO DW
:FR T
Figure 3-10. Executing a "DO" Operation
STL
:C
DB 202
:L
KB 20
:T
DW 1
F 1
:L
KH 0
:DO
DW 1
:T
DW 0
:L
DW 1
:L
KB 1
:+F
:T
DW 1
:L
KB 100
:<=F
:JC = F 1
Actual program
6
:C
12
:A
0.0
13
:FR T
0
Explanation
Call data block DB202.
Load constant number 20 in ACCU 1.
Transfer contents from ACCU 1 to
data word DW1.
Load hex constant 0 in ACCU 1.
DO data word DW1.
Transfer the contents from ACCU 1
to the data word whose address is
stored in data word DW1.
Load data word DW1 in ACCU 1.
Load constant number 1 in ACCU 1.
Data word DW1 is shifted to
ACCU 2.
ACCU 2 und ACCU 1 are added, and
the result is stored in ACCU 1 (data
word address is higher).
Transfer contents of ACCU 1 to data
word DW1 (new data word
address).
The constant number 100 is loaded
in ACCU 1 and the new data word
address is shifted to ACCU 2.
Compare the ACCUs for less than or
equal to: ACCU 2 ACCU 1.
Jump conditionally to label F1, if
ACCU 2 ACCU 1.
S5-115F Manual
DB
6
.
.
.
.
F
8.1
.
1
EWA 4NEB 811 6149-02

Advertisement

Table of Contents
loading

This manual is also suitable for:

S5-115f

Table of Contents