3 . Instruction Set

API

20

 

Mnemonic

 

Operands

Function

 

 

 

 

 

 

D

ADD

 

P

 

Addition

 

 

 

 

 

 

Controllers

ES2/EX2

SS2

SA2

SX2

SE

 

Type

 

Bit Devices

 

 

 

 

Word devices

 

 

 

 

 

 

Program Steps

 

OP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X

Y

M

S

 

K

H

KnX

KnY

KnM

KnS

T

C

D

E

F

ADD, ADDP: 7 steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S1

 

 

 

 

 

 

 

*

*

*

*

*

*

*

*

*

 

*

*

DADD, DADDP: 13 steps

S2

 

 

 

 

 

 

 

*

*

*

*

*

*

*

*

 

*

*

*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

D

 

 

 

 

 

 

 

 

 

 

*

*

*

*

*

*

 

*

*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PULSE

 

 

 

16-bit

 

 

 

 

32-bit

 

 

 

 

 

 

 

 

ES2/EX2

SS2

SA2

SX2

ES2/EX2

SS2

 

SA2

SX2

ES2/EX2

SS2

 

SA2

SX2

 

 

 

 

 

 

SE

 

SE

 

SE

Operands:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S1: Summand

S2: Addend

 

D: Sum

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Explanations:

1.This instruction adds S1 and S2 in BIN format and store the result in D.

2.The most significant bit (MSB) is the sign bit of the data. 0 indicates positive and 1 indicates negative. All calculations is algebraically processed, e.g. 3 + (-9) = -6.

3.If S1, S2 and D use device F, only 16-bit instruction is applicable.

4.Flags: M1020 (Zero flag), M1021 (Borrow flag), M1022 (Carry flag)

Program Example 1:

In 16-bit BIN addition:

When X0 = ON, the content in D0 will plus the content in D10 and the sum will be stored in D20.

X0

ADD D0 D10 D20

Program Example 2:

In 32-bit BIN addition:

When X0 = ON, the content in (D31, D30) will plus the content in (D41, D40) and the sum will be stored in (D51, D50). D30, D40 and D50 are low word; D31, D41 and D51 are high word

X0

DADD D30 D40 D50

(D31, D30) + (D41, D40) = (D51, D50)

Operation of flags:

16-bit instruction:

1.If the operation result is “0”, the zero flag M1020 will be ON.

2.If the operation result exceeds -32,768, the borrow flag M1021 will be ON.

3.If the operation result exceeds 32,767, the carry flag M1022 will be ON.

32-bit instruction:

1.If the operation result is “0”, the zero flag, M1020 will be ON.

3 - 75

Page 191
Image 191
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Add, Operation of flags