Decrement/Increment - Siemens SIMATIC S5-115U User Manual

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

STEP 5 Operations
8.2.7

Decrement/Increment

The decrement/increment operations change the data loaded into ACCUM 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 ACCUM 1 are to be changed.
The operations refer to decimal values; however, the result is stored in ACCUM 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 DW 8.
In addition, decrement the
incrementation result by 33 and
store the new result in data word
DW 9.
8-52
Table 8-17. Decrement/Increment Operations
Decrement
Decrement the contents of the accumulator.
Increment
Increment the contents of the accumulator.
The contents of ACCUM 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
STL
C
L
I
T
D
T
Meaning
Explanation
DB 6
Call data block DB6.
KH 1010
Load hexadecimal constant 1010
into ACCUM 1.
16
Increment the low byte of
ACCUM 1 by 16. The result, 1020
is located in ACCUM 1.
DW 8
Transfer the contents of ACCUM 1
(1020
) to data word DW 8. Since
H
the incrementation result is still
in ACCUM 1, you can decrement
by 33 directly.
33
The result would be FFF
However, since the high byte of
ACCUM 1 is not decremented
along with the low byte, the
result in ACCUM 1 is 10FF
DW 9
The contents of ACCUM 1 are
transferred to DW 9 (10FF
S5-115U Manual
H
,
H
.
H
.
H
).
H
EWA 4NEB 811 6130-02b

Advertisement

Table of Contents
loading

Table of Contents