DVP - ES2/EX2/SS2/SA2/SX2/SE Operation Manual - Programming

API

Mnemonic

Operands

Function

Controllers

43

D

SUM

 

P

 

 

 

 

Sum of Active bits

 

 

 

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

SUM, DSUMP: 5 steps

 

S

 

 

 

 

*

*

*

*

*

*

*

*

*

*

*

DSUM, DSUMP: 9 steps

 

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:

S: Source device D: Destination device for storing counted value

Explanation:

1.This instruction counts the total active bits in S and store the value in D.

2.D will occupy two registers when using in 32-bit instruction.

3.If operand S, D use index F, only a 16-bit instruction is available.

4.If there is no active bits, zero flag M1020 =ON.

Program Example:

When X20 = ON, all active bits in D0 will be counted and the result will be stored in D2.

X20

D0

 

SUM

D2

0

0

0

1

0

0

1

0

0

0

0

0

0

1

0

0

3

 

 

 

 

 

 

 

D0

 

 

 

 

 

 

 

D2

3 - 108

Page 224
Image 224
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Sum