beautypg.com

Delta DVP-ES2 User Manual

Page 176

background image

D V P - E S 2 / S A 2 / S S 2 / S A2 / S X 2 / S E O p e r a t i o n M a n u a l - P r o g r a m m i n g

3 - 6 0

API Mnemonic

Operands

Function

10

D CMP P

Compare

Controllers

ES2/EX2 SS2

SA2

SE

SX2

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

*

*

*

CMP, CMPP: 7 steps

DCMP, DCMPP: 13 steps

PULSE 16-bit 32-bit

ES2/EX2 SS2

SA2

SE

SX2 ES2/EX2 SS2

SA2

SE

SX2 ES2/EX2 SS2

SA2

SE

SX2

Operands:

S

1

: Comparison Value 1 S

2

: Comparison Value 2 D: Comparison result

Explanations:

1. The

contents

of

S

1

and S

2

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 S

1

> S

2

, D +1 = ON if S

1

= S

2

, D +2 = ON if S

1

< S

2

4. If

operand

S

1

, S

2

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

Y0

Y1

Y2

CMP

K10

D10

Y0

If K10>D10, Y0 = On

If K10=D10, Y1 = On

If K10

3.

Use RST or ZRST instruction to reset the comparison result.

X10

RST

M0

RST

RST

M1

M2

X10

ZRST

M0

M2

This manual is related to the following products: