16bit and 32bit unsigned data comparison

Relational operators (Unsigned operations) for 16Bit(Word) and 32Bit(Double word) Data

 

Relational operators compare two values or strings to provide a true and false result.

If the comparison is true, the result is 1. (Instruction will carry on)

If the comparison is false, the result is 0. (Instruction will no carry on)

S1

Value to compare

S2

Value to compare

 

Instruction

Device address

No. of Steps

Flag

M

X

Y

K

L

F

T

C

S

Z

D

@D

Int.

Error

Zero

Carry

UCMP

UDCMP

S1

o

o

o

o

o

-

-

-

-

o

o

o

o

3

o

-

-

S2

o

-

o

o

o

-

-

-

-

o

o

o

o

 

UCMP

Functions

  • Compare two values S1 and S2 and if the comparison is true then set the Flag (F120~125) to 1.

  • S1 and S2 are unsigned number.

  • S1 =, <, >, <=, >=, <> S2 → Flag (F120~125)

Comparison

Operator

Flag

< Less than

S1 < S2

F120

<= Less than or equal

S1 <= S2

F121

= equal to

S1 = S2

F122

> Greater than

S1 > S2

F123

>= Greater than or equal

S1 >= S2

F124

<> Not equal

S1 ≠ S2

F125

 

Example)

If M00 is ON and D100 is less than D90 then Y10 will be turned ON.

 

 

 

UDCMP

Functions

  • Compare four values (double words) S1, S1+1 and S2, S2+1 and if the comparison is true then set the Flag (F120~125) to 1.

  • S1, S1+1 and S2, S2+1 are unsigned number.

  • (S1, S1+1) =, <, >, <=, >=, <> (S2, S2+1) → Flag (F120~125)

Comparison

Operator

Flag

< Less than

S1 < S2

F120

<= Less than or equal

S1 <= S2

F121

= equal to

S1 = S2

F122

> Greater than

S1 > S2

F123

>= Greater than or equal

S1 >= S2

F124

<> Not equal

S1 ≠ S2

F125

 

Example)

If M00 is ON and D100 and D101 are greater than D90 and D91 then Y11 will be turned ON.