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

Cp1h/cp1l cpu unit
Table of Contents

Advertisement

Symbol Math Instructions
Description
Flags
Precautions
Note
Examples
360
–CL(413) subtracts the binary values in Su and Su+1 and CY from Mi and
Mi+1, and outputs the result to R, R+1. When the result is negative, it is output
to R, R+1 as a 2's complement.
Mi+1
Su+1
CY will turn
ON when there
R+1
CY
is a borrow.
Name
Label
Error Flag
ER
Equals Flag
=
Carry Flag
CY
Overflow Flag
OF
Underflow Flag
UF
Negative Flag
N
When –CL(413) is executed, the Error Flag will turn OFF.
If as a result of the subtraction, the content of R, R+1 is 00000000 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 and CY from a positive number
is negative (in the range 80000000 to FFFFFFFF hex), the Overflow Flag will
turn ON.
If the result of subtracting a positive number and CY from a negative number
is positive (in the range 00000000 to 7FFFFFFF hex), the Underflow Flag will
turn ON.
If as a result of the subtraction, the content of the leftmost bit of R+1 is 1, the
Negative Flag will turn ON.
To clear the Carry Flag (CY), execute the Clear Carry (CLC(041)) instruction.
When CIO 0.01 is ON in the following example, D1101, D1100 and CY will be
subtracted from D1001 and D1000 as 8-digit signed binary values, and the
result will be output to D1201 and D1200.
0.01
D1000
D1100
D1200
(Signed binary)
Mi
(Signed binary)
Su
CY
(Signed binary)
R
Operation
OFF
ON when the result is 0.
OFF in all other cases.
ON when the results in a borrow.
OFF in all other cases.
ON when the result of subtracting a negative number and
CY from a positive number is in the range 80000000 to
FFFFFFFF hex.
OFF in all other cases.
ON when the result of subtracting a positive number and
CY from a negative number is in the range 00000000 to
7FFFFFFF 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