Delta Electronics AH500 Manual page 153

Motion control module
Hide thumbs Also See for AH500:
Table of Contents

Advertisement

A H 5 00 M o ti on C on tr ol M od ul e Ma nua l
API
Instruction code
21
D
SUB
Device
X
Y
M
S
1
S
2
D
E xp la nat io n
E xamp le 1
E xamp le 2
Operand
P
S
S
K
16#
F
Pulse instruction 16-bit instruction (7 steps) 32-bit instruction (9 steps)
S
: Minuend; S
: Subtrahend; D: Difference
1
2
The binary value in S
is subtracted from the binary value in S
2
difference is stored in D.
The highest bit in S
and the highest bit in S
1
in a register is 0, the value in the register is a positive value. If the sign
bit in a register is 1, the value in the register is a negative value.
SM1064 is the zero flag in an Ox motion subroutine, and SM968 is the
zero flag in O100.
SM1065 is the borrow flag in an Ox motion subroutine, and SM969 is the
borrow flag in O100.
SM1066 is the carry flag in an Ox motion subroutine, and SM970 is the
carry flag in O100.
The flags related to 16-bit binary subtraction and 32-bit binary
subtraction are listed below.
16-bit binary subtraction:
1. If the operation result gotten is 0, a zero flag will be ON.
2. If the operation result gotten is less than –32,768, a borrow flag will
be ON.
3. If the operation result gotten is greater than 32,767, a carry flag will
be ON.
32-bit binary subtraction:
1. If the operation result gotten is 0, a zero flag will be ON.
2. If the operation result gotten is less than –2,147,483,648, a borrow
flag will be ON.
3. If the operation result gotten is greater than 2,147,483,647, a carry
flag will be ON.
Please refer to the additional remark on the instruction ADD for more
information about the relations between flags and values.
16-bit binary subtraction: When X0.0 is ON, the subtrahend in D10 is
subtracted from the minuend in D0, and the difference is stored in D20.
X0.0
S UB
When X0.1 is ON, the subtrahend in (D41, D40) is subtracted from the
minuend in (D31, D30), and the difference is stored in (D51, D50).
X0.1
D SU B
, S
, D
1
2
KnM KnS
D
W
are sign bits. If the sign bit
2
D0
D10
D 30
D 40
Function
Binary subtraction
T
C
V
Z
, and the
1
D 20
D50
5 - 3 8

Advertisement

Table of Contents
loading

Table of Contents