Chapter 6 Instruction Details
XBC E-Type Main Unit
6-176
Ver. 1
6.29 BCD Operation Instruction
6.29.1 ADDB, ADDBP, DADDB, DADDBP
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)
ADDB(P)
DADDB(P)
S1 O O O O O O O - O -
- O O O O O
4~6
O
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
BCD data to be added to S2
WORD/DWORD
S2
BCD data to be added to S1
WORD/DWORD
D
Address to save operation result in
WORD/DWORD
[Flag Set]
Flag
Description
Device
Number
Error
If the value of S1 and S2 is not of BCD format.
F110
Zero
To be set if operation result is Zero.
F111
Carry
To be set if operation result is Overflow.
F112
1) ADDB (BCD ADD)
(1) Saves the result of BCD data S1 and S2 added in D.
(2) Based on operation result, Error(F110), Zero(F111), or Carry(F112) Flag will be set.
5
6
7
8
D
1
2
3
4
S
6
9
1
2
D
+
2) DADDB (BCD Double ADD)
(1) Saves the result of BCD data (S1 ,S1+1) and (S2, S1+1) added in (D, D+1).
(2) 0~99,999,999 (BCD 8-digit) is available for S1 and S2.
(3) If 99,999,999 is exceeded, rounding off will be disregarded and Carry Flag will not be Set.
0 9
8
7
1 0
6
8
0 0
3
2
3 4
5
6
1 0
1
9
4 5
2
4
+
D 1
D
Upper 4- digit
Lower 4-digit
+
S 1
S
Upper 4- digit
Lower 4-digit
+
+
D 1
D
Upper 4- digit
Lower 4-digit
Other places than specified will be regarded as 0
3) Program Example
(1) For P1000=’100’ and P1100=’200’, if Input Signal P00000 is changed from Off to On, BCD data ‘300’ is
saved in P1200.
ADDB P1000 P1100 P1200
P00000
ADDB, DADDB
P S1 S2
ADDBP, DADDBP
S1 S2
means
ADDB
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...