168
6 BASIC INSTRUCTIONS
6.2 Arithmetic Operation Instructions
â– When specifying the same device in the source and destination
The same device number can be specified for both the source and the destination. In this case, note that the subtraction result
changes in every operation cycle if a continuous operation type SUB instruction is used.
â– Difference between SUB(P) instruction, -(P) instruction, and DEC(P) instruction in a program
for subtracting "-1"
When SUB(P) instruction is used to subtract 1 from the contents of D0 every time X1 turns from OFF to ON, SUB(P)
instruction is similar to -(P) instruction and DEC(P) instruction described later except for the contents shown in the table below
There is no operation error.
SUB(P) instruction -(P) instruction, DEC(P) instruction
Flag (zero, borrow or carry) Operates Does not operate
Operation result (s)-1=(d) -32768  0  -1  -2 … -32768  +32767  +32766 …
SUB
D0 K25 D0
X1
(D0)-25 → (D0)