Data comparison instructions, Cmp= (compare equal to), Cmp<> (compare unequal to) – IDEC MicroSmart User Manual

Page 229: Cmp< (compare less than), Cmp> (compare greater than), Cmp<= (compare less than or equal to), Cmp>= (compare greater than or equal to), Omparison, Nstructions

Advertising
background image

« FC4A M

ICRO

S

MART

U

SER

S

M

ANUAL

»

10-1

10: D

ATA

C

OMPARISON

I

NSTRUCTIONS

Introduction

Data can be compared using data comparison instructions, such as equal to, unequal to, less than, greater than, less than or
equal to, and greater than or equal to. When the comparison result is true, an output or internal relay is turned on. The
repeat operation can also be used to compare more than one set of data.

Three values can also be compared using the ICMP>= instruction.

Since the data comparison instructions are executed in each scan while input is on, a pulse input from a SOTU or SOTD
instruction should be used as required.

CMP= (Compare Equal To)

CMP<> (Compare Unequal To)

CMP< (Compare Less Than)

CMP> (Compare Greater Than)

CMP<= (Compare Less Than or Equal To)

CMP>= (Compare Greater Than or Equal To)

S1 = S2

→ D1 on

When input is on, 16-bit data designated by source operands S1
and S2 are compared. When S1 data is equal to S2 data, desti-
nation operand D1 is turned on. When the condition is not met,
D1 is turned off.

REP

**

S1(R)

*****

D1(R)

*****

CMP=(*)

S2(R)

*****

S1

≠ S2 → D1 on

When input is on, 16-bit data designated by source operands S1
and S2 are compared. When S1 data is not equal to S2 data,
destination operand D1 is turned on. When the condition is not
met, D1 is turned off.

REP

**

S1(R)

*****

D1(R)

*****

CMP<>(*)

S2(R)

*****

S1 < S2

→ D1 on

When input is on, 16-bit data designated by source operands S1
and S2 are compared. When S1 data is less than S2 data, desti-
nation operand D1 is turned on. When the condition is not met,
D1 is turned off.

REP

**

S1(R)

*****

D1(R)

*****

CMP<(*)

S2(R)

*****

S1 > S2

→ D1 on

When input is on, 16-bit data designated by source operands S1
and S2 are compared. When S1 data is greater than S2 data,
destination operand D1 is turned on. When the condition is not
met, D1 is turned off.

REP

**

S1(R)

*****

D1(R)

*****

CMP>(*)

S2(R)

*****

S1

≤ S2 → D1 on

When input is on, 16-bit data designated by source operands S1
and S2 are compared. When S1 data is less than or equal to S2
data, destination operand D1 is turned on. When the condition is
not met, D1 is turned off.

REP

**

S1(R)

*****

D1(R)

*****

CMP<=(*)

S2(R)

*****

S1

≥ S2 → D1 on

When input is on, 16-bit data designated by source operands S1
and S2 are compared. When S1 data is greater than or equal to
S2 data, destination operand D1 is turned on. When the condi-
tion is not met, D1 is turned off.

REP

**

S1(R)

*****

D1(R)

*****

CMP>=(*)

S2(R)

*****

Advertising