Mitsubishi MELSEC-Q/L Programming Manual page 202

Table of Contents

Advertisement

B+, B+P, B-, B-P
Function
B+
(1) Adds the BCD 4-digit data designated by
addition at the device designated by
(2) 0 to 9999 (BCD 4 digits) can be assigned to
(3) If the result of the addition operation exceeds 9999, the higher bits are ignored.
The carry flag in this case does not go ON.
B-
(1) Subtracts the BCD 4-digit data designated by
subtraction at the device designated by
(2) 0 to 9999 (BCD 4 digits) can be assigned to
(3) The following will result if an underflow is generated by the subtraction operation:
The carry flag in this case does not go ON.
Operation Error
(1) In the following case, an operation error occurs, the error flag (SM0) turns ON, and an error code is stored into SD0.
Error
code
4100
or
BCD data is outside the 0 to 9999 range.
S1
S2
Program Example
(1) The following program adds the D3 BCD data and the Z1 BCD data when X20 goes ON, and outputs the result to Y8 to
Y17.
[Ladder Mode]
(2) The following program subtracts the BCD data at D20 from the BCD data at D10 when X20 goes ON, and stores the
result at R10.
[Ladder Mode]
200
and the BCD 4-digit data designated by
S1
.
D
S1
5
6
7
8
1
2
,
and
S1 S2
D
6
4
3
2
3
5
and the BCD 4-digit data designated by
S1
.
D
S1
0
6
7
8
0
2
Digits exceeding the designated
number of digits are assumed to be 0.
,
and
S1 S2
D
0
0
0
1
0
0
Error details
[List Mode]
Step
[List Mode]
Step
S2
D
3
4
6
9
1
.
8
3
0
0
1
S2
D
3
4
0
4
4
.
0
3
9
9
9
Q00J/
Q00/
QnH
Q01
Instruction
Device
Instruction
Device
, and stores the result of the
S2
2
5
, and stores the result of the
S2
4
8
QnPH QnPRH
QnU
LCPU

Advertisement

Table of Contents
loading

Table of Contents