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

API

10

Mnemonic

Operands

Function

Controllers

D

CMP

P

Compare

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

CMP, CMPP: 7 steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S1

 

 

 

 

 

 

 

*

*

*

*

*

 

 

*

 

*

*

*

 

*

*

DCMP, DCMPP: 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: Comparison Value 1

 

S2: Comparison Value 2

 

D: Comparison result

 

 

Explanations:

1.The contents of S1 and S2 are compared and D stores the comparison result.

2.The comparison values are signed binary values. If b15=1 in 16-bit instruction or b31=1 in 32-bit instruction, the comparison will regard the value as a negative binary value.

3.Operand D occupies 3 continuous devices. D, D +1, D +2 hold the comparison results,

D = ON if S1 > S2, D +1 = ON if S1 = S2, D +2 = ON if S1 < S2

4.If operand S1, S2 use index register F, only 16-bit instruction is available.

Program example:

1.If D is set as Y0, then Y0, Y1, Y2 will display the comparison results as shown below.

2.When X20 = ON, CMP instruction is executed and one of Y0, Y1, Y2 will be ON. When X20 = OFF, CMP instruction is not executed and Y0, Y1, Y2 remain in their previous condition.

X20

CMP K10 D10 Y0

Y0

If K10>D10, Y0 = On

Y1

If K10=D10, Y1 = On

Y2

If K10<D10, Y2= On

3.Use RST or ZRST instruction to reset the comparison result.

X10

RST M0

RST M1

X10

ZRST M0 M2

RST M2

3 - 60

Page 176
Image 176
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Api, Cmp