Hitachi NJI-350B User Manual
Page 99

Chapter 5 Instruction Specifications
5-49
Item number
Arithmetic instructions-4
Name
Binary subtraction (BINARY SUBTRACTION)
Ladder format
Condition code
Processing time (
µs)
Remark
R7F4
R7F3
R7F2
R7F1
R7F0
Average Maximum
d = s1 – s2
DER
ERR
SD
V
C
Upper case: W
z
z
z
↕
↕
41
Lower case: DW
Instruction format
Number of steps
Condition
Steps
d = s1 – s2
Word
4
58
Double word
6
Bit
Word
Double word
Usable I/O
X
Y
R,
M
TD, SS,
CU, CT
WX WY
WR,
WM TC DX DY
DR,
DM
C
onstant
Other
d
Substitution destination
{
{
{
{
{
s1 Minuend
{
{
{
{
{
{
{
{
s2 Subtrahend
{
{
{
{
{
{
{
{
Function
• Subtracts s2 from s1 as the binary data, and substitutes the result into d as the binary data.
• The C flag is set to “1” if there is a digit decrease, and “0” if not.
C = s1m x s2m + s1m x dm + s2m x dm
• The V flag is set to “1” if the operation result is a meaningless signed-binary data, and “0” if it has meaning.
s1
s2
d
V
Positive
Positive
Positive/Negative
0
Negative
Negative
Positive/Negative
0
Positive
Negative
Positive
0
Positive
Negative
Negative
1
Negative
Positive
Positive
1
Negative
Positive
Negative
0
s1
d
0
0
0
s2m
dm
C
−
Most significant bit
s2
s1m
V = s1m x s2m x dm + s1m x s2m x dm
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
WR0002 = WR0000 - WR0001
LD X00000
[
WR0002 = WR0000 - WR0001
]
Program description
• When input X00000 is on, the difference between WR0000 value and WR0001 value is substituted into WR0002.
d =
s1
–
s2