Hitachi NJI-350B User Manual
Page 100

Chapter 5 Instruction Specifications
5-50
Item number
Arithmetic instructions-5
Name
BCD subtraction (BCD SUBTRACTION)
Ladder format
Condition code
Processing time (
µs)
Remark
R7F4
R7F3
R7F2
R7F1
R7F0
Average Maximum
d = s1 B– s2
DER
ERR
SD
V
C
Upper case: W
↕
z
z
z
↕
104
Lower case: DW
Instruction format
Number of steps
Condition
Steps
d = s1 B– s2
Word
4
163
Double word
6
Bit
Word
Double word
Usable I/O
X
Y
R,
M
TD, SS,
WDT, MS,
TMR, CU,
RCU, CT WX WY
WR,
WM TC DX DY
DR,
DM
C
o
nstant
Other
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
s1
s2
Word
Word
Word
Double word
Double word
Double word
Program example
X00000
WR0003 = WR0004 B- WR0005
LD X00000
[
WR0003 = WR0004 B- WR0005
]
Program description
• When input X00000 is on, the difference between WR0004 value and WR0005 value is substituted into WR0003 as BCD
data.
d
=
s1
B–
s2