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 #398 background imageLoading...
Page #398 background image
3. Instructions
360
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Hint
• 2's Complement
A 2’s complement is the value obtained by subtracting each binary digit from 1 and adding one to the
result. For example, the 2’s complement for 1101 is calculated as follows: 1111 (F hexadecimal) –
1101 (D hexadecimal) + 1 (1 hexadecimal) = 0011 (3 hexadecimal). The 2’s complement for 3039
(hexadecimal) is calculated as follows: FFFF (hexadecimal) – 3039 (hexadecimal) + 0001
(hexadecimal) – CFC7 (hexadecimal). Therefore, in case of 4-digit hexadecimal value, the 2’s
complement can be calculated as follows: FFFF (hexadecimal) – a (hexadecimal) + 0001
(hexadecimal) = b (hexadecimal). To obtain the true number from the 2’s complement b
(hexadecimal): a (hexadecimal) = 10000 (hexadecimal) – b (hexadecimal). For example, to obtain the
true number from the 2’s complement CFC7 (hexadecimal): 10000 (hexadecimal) – CFC7 = 3039.
20F55A10 - B8A360E3 = -97AE06D3. (Hexadecimal)
In this example, the eight-digit binary value in CIO 121 and CIO 120 is subtracted from the value in CIO
201 and CIO 200, and the result is output in eight-digit binary to D101 and D100. If the result is
negative, the instruction at (2) will be executed, and the actual result will then be output to D101 and
D100.
−1
+1
−)
65535
1
−)
−)
−3
−1
−)
65533
65535
−)
−)
Note 1.
2.
3.
4.
Example 1
Signed data Unsigned data
Example 2
Signed data Unsigned data
FFFF Hex
0001 Hex
FFFE Hex
−2
Note 1
65534 Note 2
FFFD Hex
FFFF Hex
FFFE Hex
−2
Note 3 65534 Note 4
Carry Flag OFF
Negative Flag ON
Carry Flag OFF
Negative Flag ON
Since the Negative Flag is ON, the result (FFFE hex) is
a negative value (2's complement) and is thus −2.
Since the Carry Flag is OFF, the result (FFFE hex) is
an unsigned positive value of 65534.
Since the Negative Flag is ON, the result (FFFE hex) is
a negative value (2's complement) and is thus −2.
Since the Carry Flag is ON, the result (FFFE hex) is a
negative value (2's complement) and becomes −2
when converted to a true value.
−L
200
120
D100
0.00
(1)
CY
CY
(2)
RSET
21.00
SET
21.00
−L
#00000000
D100
D100
"−"display

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