222
6 BASIC INSTRUCTIONS
6.2 Arithmetic Operation Instructions
+(P), -(P) [When three data are set]
■+
• Adds 16-bit BIN data designated by (S1) to 16-bit BIN data designated by (S2) and stores the result of the addition at the
device designated by (D).
• Values for (S1), (S2) and (D) can be designated between (D) -32768 and 32767 (BIN, 16 bits).
• The judgment of whether data is positive or negative is made by the most significant bit (b15).
• The following will happen when an underflow or overflow is generated in an operation result: The carry flag (SM700) in this
case does not turn ON.
■-
• Subtracts 16-bit BIN data designated by (S1) from 16-bit BIN data designated by (S2) and stores the result of the
subtraction at the device designated by (D).
• Values for (S1), (S2) and (D) can be designated between (D) -32768 and 32767 (BIN, 16 bits).
• The judgment of whether data is positive or negative is made by the most significant bit (b15).
• The following will happen when an underflow or overflow is generated in an operation result: The carry flag (SM700) in this
case does not turn ON.
(S1): Data to be added to/subtracted from or head number of the devices where the data to be added to/subtracted from is stored (BIN 16 bits)
(S2): Data for adding/subtracting or head number of the devices where the data for adding/subtracting is stored (BIN 16 bits)
(D): Head number of the devices where the operation result will be stored (BIN 16 bits)
Setting
data
Internal device R, ZR J\ U\G Zn Constant
K, H
Others
Bit Word Bit Word
(S1)
(S2)
(D)
•0 Positive
•1 Negative
•0 Positive
•1 Negative
Command
Command
P
+,
+/
+P, P
S1
S2
D
S1
S2
D
indicates an instruction symbol of .
b0
5678 (BIN)
b15 b0
6912 (BIN)
b15b0
1234 (BIN)
b15
S1 S2
D
Since bit 15 value is "0",
result of operation takes a positive value.
Since bit 15 value is "1",
result of operation takes a negative value.
K32767 +K2
K 32768 +K
2
K
32767
(7FFF
H) (0002H) (8001H)
(8000
H) (FFFEH)
K32766
(7FFE
H)
b0
5678 (BIN)
b15 b0
4444 (BIN)
b15b0
1234 (BIN)
b15
S1
S2
D
Since bit 15 value is "0",
result of operation takes a positive value.
Since bit 15 value is "1",
result of operation takes a negative value.
K32767
K2
(7FFF
H
) (FFFE
H
)
K2
(8000
H
) (0002
H
)
K
32767
K3276
6
(7FFE
H
)
(8001
H
)
K 32768