Decrement/Increment - Siemens SIMATIC S5-95F Manual

Table of Contents

Advertisement

S5-95F
8.2.7

Decrement/Increment

The decrement/increment operations change the data loaded into ACCU 1. Table 8-17 provides an
overview of the decrement/increment operations. An example follows the table.
Operation
Operand
D
I
Processing
Execution of the decrement and increment operations is independent of the RLO and does not affect
the RLO or the condition codes.
The parameter indicates the value by which the contents of ACCU 1 are to be changed.
The operations refer to decimal values; however, the result is stored in ACCU 1 in binary form.
Changes relate only to the low byte in the accumulator.
Example
Increment the hexadecimal constant
1010
by 16 and store the result in
H
data word DW8.
In addition, decrement the incremen-
tation result by 33 and store the new
result in data word DW9.
EWA 4NEB 812 6210-02
Table 8-17. Decrement/Increment Operations
Decrement
Decrement the contents of the accumulator.
Increment
Increment the contents of the accumulator.
The contents of ACCU 1 are either decremented or incremented by
the number indicated in the parameter.
Execution of the operation is unconditional and is limited to the
right-hand byte (without carry).
Parameter
0 to 255
C
L
I
T
D
T
Meaning
STL
Call data block DB6.
DB
6
Load hexadecimal constant 1010
KH
1010
into ACCU 1.
Increment the low byte of ACCU 1
16
by 16. The result, 1020
located in ACCU 1.
Transfer the contents of ACCU 1
DW
8
(1020
H
the incrementation result is still in
ACCU 1, you can decrement by 33
directly.
The result would be FFF
33
However, since the high byte of
ACCU 1 is not decremented along
with the low byte, the result in
ACCU 1 is 10FF
The contents of ACCU 1 are
DW
9
transferred to DW9 (10FF
STEP 5 Operations
Explanation
, is
H
) to data word DW8. Since
.
H
.
H
).
H
H
8-51

Advertisement

Table of Contents
loading

Table of Contents