Chapter 6 Instruction Details
XBC E-Type Main Unit
6-166
Ver. 1
6.28.6 SUBU, SUBUP, DSUBU, DSUBUP
Instruction
Area Available
Step
Flag
P M K F L T C S Z D.x R.x
Co
nst.
U N D R
Error
(F110)
Zero
(F111)
Carry
(F112)
SUBU(P)
DSUBU(P)
S1 O O O O O O O - O -
- O O O O O
4~6
-
O
O
S2 O O O O O O O - O -
- O O O O O
D O O O - O O O - O -
-
- O O O O
Operand
Description
Data Type
S1
Data to be subtracted from S2
WORD/DWORD
S2
Data to be subtracted from S1
WORD/DWORD
D
Address to save operation result in
WORD/DWORD
[Flag Set]
Flag
Description
Device
Number
Zero
To be set if operation result is Zero.
F111
Carry
To be set if operation result is Overflow
F112
1) SUBU (Unsigned Binary Subtract)
(1) Saves the result of word data S1 minus S2 in D (16-bit).
(2) Performs Unsigned Operation.
(3) If operation result is below 0, Carry Flag will be set.
2) DSUBU (Unsigned Binary Double Subtract)
(1) Saves the result of word data (S1+1,S1) minus (S2+1,S2) in (D+1,D).
(2) Performs Unsigned Operation.
(3) If operation result is below 0, Carry Flag will be set.
3) Program Example
(1) For P1000=’1234’ and P1100=’5’, Input Signal P00000 is changed from Off to On status, the result of
subtraction ‘1229’ is saved in P1200.
(D)SUBU P1000 P1100 P1200
P00000
(D)SUBU
P S1 S2
(D)SUBUP
S1 S2
means
D
D
Summary of Contents for XBC-DN10E
Page 1: ......
Page 10: ...Table of Contents Table of Contents 6 10 10 CLEAR ALL PLC 29...