Item number
Arithmetic instructions-5
Ladder format
d = s1 B– s2
Instruction format
d = s1 B– s2
Usable I/O
d
Substitution destination
s1
Minuend
s2
Subtrahend
Function
•
Subtracts s2 from s1 as the BCD data, and substitutes the result into d as the BCD data.
•
The C flag is set to "1" if there is a digit decrease, and "0" if not.
•
The DER flag is set to "1" if s1 or s2 is not a valid BCD data. If so, operation is not performed and the C flag retains the
previous state without outputting to d. If the s1 and s2 are valid BCD data, the DER is set to "0."
Notes
•
The combinations of d, s1 and s2 are as follows:
d
Word
Double word
Double word
Program example
X00000
Program description
•
When input X00000 is on, the difference between WR0004 value and WR0005 value is substituted into WR0003 as BCD
data.
Name
Condition code
R7F4
R7F3
R7F2
DER
ERR
SD
↕
Number of steps
Condition
Word
Double word
Bit
TD, SS,
WDT, MS,
R,
TMR, CU,
X
Y
M
RCU, CT WX WY
s1
s2
Word
Word
Double word
WR0003 = WR0004 B- WR0005
5-50
Chapter 5 Instruction Specifications
BCD subtraction (BCD SUBTRACTION)
Processing time (µs)
R7F1
R7F0
Average Maximum
V
C
104
↕
Steps
4
163
6
Word
Double word
WR,
DR,
WM TC DX DY
DM
LD X00000
[
WR0003 = WR0004 B- WR0005
]
Remark
Upper case: W
Lower case: DW
Other