E L C P r o g r a m m i n g M a n u a l
F o r m o r e i nf o r m a t i o n v i sit :
w w w. e a t o n . c o m
MN05003003E
3-68
API Mnemonic
Operands
Function
21
D SUB P
S
1
, S
2
, D
Subtraction
Bit Devices
Word devices
Program Steps
Type
OP
X Y M S K H KnX
KnY
KnM KnS T
C D E
F
S
1
*
*
*
*
*
*
*
*
*
*
*
S
2
*
*
*
*
*
*
*
*
*
*
*
D
*
*
*
*
*
*
*
*
SUB, SUBP: 7 steps
DSUB, DSUBP: 13 steps
ELC ELCB
ELCM
PB PC/PA/PH
PV
PB PH/PA
32 16
P
32 16
P
32 16
P
32 16 P 32 16 P
Operands:
S
1
: Minuend
S
2
: Subtrahend
D
: Subtraction result
Description:
1.
The data contained within the source device,
S
2
is subtracted from the contents of source
device
S
1
. The result of this calculation is stored in the destination device
D
.
2.
The most significant bit is the sign. 0 indicates positive and 1 indicates negative. All
calculation is algebraically processed.
3. If
operand
S
1
, S
2
, D
use index register F, then only 16-bit instruction is available.
4.
Flags: M1020 (Zero flag), M1021 (Borrow flag), M1022 (Carry flag).
Program Example 1:
16-bit instruction:
When X0 = ON, the data in D10 is subtracted from the data in D0 and the result is placed in D20.
X0
SUB
D0
D10
D20
(D0)
−
(D10)
=
(D20)
Program Example 2:
32-bit instruction:
When X20 = ON, the data in (D41, D40) is subtracted from the data in (D31, D30) and the result is
placed in (D51, D50). (D30, D40, D50 is the lower 16-bit data, and D31, D41, D51 is the higher
16-bit data)
X20
DSUB
D30
D40
D50
(D31, D30)
−
(D41, D40)
=
(D51, D50)
Summary of Contents for ELC-PB
Page 1: ......
Page 5: ...For more information visit www eaton com MN05003003E iv...
Page 29: ...ELC Programming Manual For more information visit www eaton com MN05003003E 1 24 MEMO...
Page 502: ...3 Instruction Set MN05003003E For more information visit www eaton com 3 333...
Page 601: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 432...
Page 625: ...ELC Programming Manual For more information visit www eaton com MN05003003E 3 456...