EasyManuals Logo
Home>Omron>Controller>CJ - INSTRUCTIONS

Omron CJ - INSTRUCTIONS User Manual

Omron CJ - INSTRUCTIONS
1308 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #401 background imageLoading...
Page #401 background image
363
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Symbol Math Instructions
3
–C/–CL
Flags
Function
z –C
–C(412) subtracts the binary values in Su and CY from Mi, and outputs the result to R. When the result
is negative, it is output to R as a 2's complement.
z –CL
–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.
Hint
To clear the Carry Flag (CY), execute the Clear Carry (CLC(041)) instruction.
2's Complement
A 2's complement is the value obtained by subtracting each binary digit from 1 and adding one to the
result.
Example: The 2's complement for the binary number 1101 is as follows:
1111 (F hex) – 1101 (D hex) + 1 (1 hex) = 0011 (3 hex).
Example: The 2's complement for the 4-digit hexadecimal number 3039 is as follows:
FFFF hex - 3039 hex + 0001 hex = CFC7 hex.
Accordingly, the 2's complement for the 4-digit hexadecimal value “a” is as follows:
FFFF hex – a hex + 0001 hex = b hex.
And to obtain the true number “a” hex from the 2's complement “b” hex:
a hex + 10000 hex – b hex.
Example: To obtain the true number from the 2's complement CFC& hex:
10000 hex – CFC7 hex = 3039 hex.
Name Label
Operation
–C –CL
Error Flag ER OFF OFF
Equals Flag = ON when the subtraction result is 0.
OFF in all other cases.
ON when the result is 0.
OFF in all other cases.
Carry Flag CY ON when the subtraction results in a borrow.
OFF in all other cases.
ON when the results in a borrow.
OFF in all other cases.
Overflow Flag OF ON when the result of subtracting a negative num-
ber and CY 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 num-
ber and CY from a positive number is in the range
80000000 to FFFFFFFF hex.
OFF in all other cases.
Underflow Flag UF ON when the result of subtracting a positive num-
ber and CY from a negative number is in the
range 0000 to 7FFF hex.
OFF in all other cases.
ON when the result of subtracting a positive num-
ber and CY from a negative number is in the
range 00000000 to 7FFFFFFF hex.
OFF in all other cases.
Negative Flag N ON when the leftmost bit of the result is 1.
OFF in all other cases.
ON when the leftmost bit of the result is 1.
OFF in all other cases.
CY
R
CY
Mi
Su
(Signed binary)
(Signed binary)
(Signed binary)
CY will turn ON
when there is a
borrow.
R+1
CY
R
CY
Mi+1
Su+1
Mi
Su
(Signed binary)
(Signed binary)
(Signed binary)
CY will turn ON
when there is a
borrow.

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Omron CJ - INSTRUCTIONS and is the answer not in the manual?

Omron CJ - INSTRUCTIONS Specifications

General IconGeneral
BrandOmron
ModelCJ - INSTRUCTIONS
CategoryController
LanguageEnglish

Related product manuals