![background image](http://html1.mh-extra.com/html/omron/sysmac-cs-series/sysmac-cs-series_reference-manual_742030484.webp)
444
Symbol Math Instructions
Section 3-11
Precautions
When –L(411) 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 from a positive number is nega-
tive (in the range 80000000 to FFFFFFFF 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 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.
Examples
When CIO 000000 is ON in the following example, D00111 and D00110 will
be subtracted from D00101 and D00100 as 8-digit signed binary values and
the result will be output to D00121 and D00120.
Examples
If the result of the subtraction is a negative number (Mi<Su or Mi+1, Mi
<Su+1, Su), the result is output as the 2’s complement and the Carry Flag
(CY) will turn ON to indicate that the result of the subtraction is negative. To
convert the 2’s complement to the true number, an instruction which subtracts
the result from 0 is necessary using the Carry Flag (CY) as an execution con-
dition.
Note 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 cal-
culated as follows: 1111 (F hexadecimal) – 1101 (D hexadecimal) + 1 (1 hexa-
decimal) = 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 hexadeci-
mal value, the 2’s complement can be calculated as follows: FFFF (hexadeci-
mal) – 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 num-
ber from the 2’s complement CFC7 (hexadecimal): 10000 (hexadecimal) –
CFC7 = 3039.
Underflow Flag
UF
ON when the result of subtracting a positive number 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.
Name
Label
Operation
−
L
Содержание SYSMAC CS Series
Страница 2: ......
Страница 4: ...iv ...
Страница 30: ...xxx ...
Страница 186: ...146 List of Instructions by Function Code Section 2 4 ...
Страница 194: ...154 3 35 4 MOVE BIT MOVBC 568 1273 3 35 5 BIT COUNTER BCNTC 621 1275 3 35 6 GET VARIABLE ID GETID 286 1277 ...
Страница 1320: ...1280 Model Conversion Instructions Unit Ver 3 0 or Later Section 3 35 ...
Страница 1390: ...1350 CJ series Instruction Execution Times and Number of Steps Section 4 2 ...
Страница 1391: ...1351 Appendix A ASCII Code Table ASCII SP Four leftmost bits Four rightmost bits ...
Страница 1392: ...1352 ASCII Code Table Appendix A ...
Страница 1404: ...1364 Revision History ...