Arithmetic Operations - Siemens SIMATIC S5-95F Manual

Table of Contents

Advertisement

STEP 5 Operations
Caution
!
The TIR, TRS and TNB operations are memory-changing operations with which you can
access the user memory and/or the system data area. Improper use of the operations
can lead to changes in the control program and to malfunctioning of the S5-95F.
8.3.3

Arithmetic Operations

An arithmetic operation changes the contents of ACCU 1 by a specified value. The parameter re-
presents this value as a positive or negative decimal number.
Operation
Operand
ADD
ID
BF
KF
Processing
An arithmetic operation is executed independently of the RLO. It does not affect the RLO or the
condition codes.
You can subtract by entering a negative parameter.
Even if the result cannot be represented by 16 bits, no carry is made to ACCU 2, i.e., the contents
of ACCU 2 are not changed.
Example
Decrement the constant 1020
and store the result in flag word
FW28. Afterwards add the constant
256 to the result and store the sum in
flag word FW30.
8-66
Table 8-28. Arithmetic Operation
Add a constant
Add byte or word constants.
Parameter
-128
-32768 to
by 33
L
H
ADD
T
ADD
T
Meaning
to
+127
+32767
STL
The constant 1020
KH
1020
ACCU 1.
The constant -33
BF
-33
the ACCU contents.
The new ACCU contents (0FFF
FW
28
are stored in flag word FW28.
The constant 256
KF
256
the last result.
The new ACCU contents (10FF
FW
30
are stored in flag word FW30.
S5-95F
Explanation
is loaded into
H
is added to
0D
H
is added to
0D
H
EWA 4NEB 812 6210-02
)
)

Advertisement

Table of Contents
loading

Table of Contents