Siemens SIMATIC S5-95F Manual page 234

Table of Contents

Advertisement

STEP 5 Operations
Figure 8-6 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.
8-54
FB x
:C
DB
.
.
.
:DO DW
:A
F
:DO DW
:FR T
Figure 8-6. Executing a "DO" Operation
STL
:C
:L
:T
F 1
:L
:DO
:T
:L
:L
:+F
:T
:L
:<=F
:JC = F 1
Actual program
6
12
0.0
13
0
Call data block DB202.
DB 202
Load constant number 20 in
KB 20
ACCU 1.
Transfer contents from ACCU 1 to
DW 1
data word DW1.
Load hex constant 0 in ACCU 1.
KH 0
DO data word DW1.
DW 1
Transfer the contents from ACCU 1
DW 0
to the data word whose address is
stored in data word DW1.
Load data word DW1 in ACCU 1.
DW 1
Load constant number 1 in ACCU 1.
KB 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
DW 1
word DW1 (new data word address).
The constant number 100 is loaded
KB 100
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-95F
:C
DB
6
.
.
.
.
:A
F
8.1
.
:FR T
1
Explanation
EWA 4NEB 812 6210-02

Advertisement

Table of Contents
loading

Table of Contents