Omron CP - PROGRAMMING MANUAL 05-2007 Programming Manual page 385

Cp1h/cp1l cpu unit
Table of Contents

Advertisement

Symbol Math Instructions
Description
Flags
Precautions
Examples
352
–(400) subtracts the binary values in Su from Mi and outputs the result to R.
When the result is negative, it is output to R as a 2's complement. (Refer to 3-
10-10 DOUBLE SIGNED BINARY SUBTRACT WITHOUT CARRY: –L(411)
for an example of handling 2's complements.)
CY will turn ON
CY
when there is a
borrow.
Name
Label
Error Flag
ER
Equals Flag
=
Carry Flag
CY
Overflow Flag
OF
Underflow Flag
UF
Negative Flag
N
When –(410) is executed, the Error Flag will turn OFF.
If as a result of the subtraction, the content of R is 0000 hex, the Equals Flag
will turn ON.
If the subtraction results in a borrow, the Carry Flag will turn ON.
If the result of subtracting a negative number from a positive number is nega-
tive (in the range 8000 to FFFF hex), the Overflow Flag will turn ON.
If the result of subtracting a positive number from a negative number is posi-
tive (in the range 0000 to 7FFF hex), the Underflow Flag will turn ON.
If as a result of the subtraction, the content of the leftmost bit of R is 1, the
Negative Flag will turn ON.
When CIO 0.00 is ON in the following example, D200 will be subtracted from
D100 as 4-digit signed binary values and the result will be output to D300.
0.00
D100
D200
D300
(Signed binary)
Mi
(Signed binary)
Su
(Signed binary)
R
Operation
OFF
ON when the result is 0.
OFF in all other cases.
ON when the subtraction results in a borrow.
OFF in all other cases.
ON when the result of subtracting a negative number from
a positive number is in the range 8000 to FFFF hex.
OFF in all other cases.
ON when the result of subtracting a negative number from
a positive number is in the range 0000 to 7FFF hex.
OFF in all other cases.
ON when the leftmost bit of the result is 1.
OFF in all other cases.
Section 3-10

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents