3. Instruction Set

API

185

Mnemonic

 

Operands

Function

 

 

 

 

 

 

 

MCMP

 

P

 

Matrix compare

 

 

 

 

 

 

Controllers

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

MCMP, MCMPP: 9 steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S1

 

 

 

 

 

 

*

*

 

*

 

*

 

*

*

*

 

 

 

 

 

 

 

 

 

S2

 

 

 

 

 

 

*

*

 

*

 

*

 

*

*

*

 

 

 

 

 

 

 

 

 

n

 

 

 

 

*

*

 

 

 

 

 

 

 

 

 

 

 

*

 

 

 

 

 

 

 

 

 

D

 

 

 

 

 

 

 

 

*

 

*

 

*

 

*

*

*

*

 

*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

16-bit

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PULSE

 

 

 

 

 

 

 

 

32-bit

 

 

 

 

 

 

 

 

 

 

ES2/EX2

SS2

SA2

SX2

ES2/EX2

SS2

SA2

SX2

ES2/EX2

SS2

SA2

SX2

 

 

 

 

 

 

 

 

SE

SE

SE

Operands:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S1: Matrix source device 1

S2: Matrix source device 2

n: Matrix length (K1~K256)

 

 

D: Pointer Pr; comparison result (bit number)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Explanations:

1.MCMP instruction compares each bit between matrix S1 and matrix S2 and stores the bit number of the comparison result in D. The comparison starts from the next bit of the pointer.

2.The matrix comparison flag (M1088) decides to compare between equivalent values (M1088 = ON) or different values (M1088 = OFF). When the comparison is completed, it will stop immediately and M1091= ON to indicate that matched result is found. When the comparison progresses to the last bit, M1089 = ON to indicate that the comparison has come to the end of the matrix and the number of the last bit will be stored in D. In next scan cycle, comparison starts again from the first bit (bit 0), at the same time M1090 = ON to indicate the start of the comparison. When D (Pr) exceeds the valid range, M1092 = ON to indicate pointer error, and the instruction will be disabled.

3.The matrix operation requires a 16-bit register for designating a bit among the 16n bits in the matrix. The register is the Pointer (Pr) of the matrix, designated by the user in the instruction. The valid range of Pr is 0 ~ 16n -1, corresponding to b0 ~ b16n-1 in the matrix. The value of pointer should not be modified during the execution of matrix instructions so as to prevent execution errors.

4.When M1089 and M1091 take place at the same time, both flags will ON..

5.If operands S1, S2, or D use KnX, KnY, KnM, KnS format, only n = 4 is applicable.

Program Example:

When X0 goes from OFF to ON with M1090 = OFF (comparison starts from Pr), the search will start from the bit marked with “*” (current Pr value +1) for the bits with different status (M1088 = OFF).

Assume pointer D20 = 2, the following four results (n, o, p, q) can be obtained when X0 goes from OFF→ON for four times.

nD20 = 5, M1091 = ON (matched result found), M1089 = OFF

3 - 4 1 3

Page 529
Image 529
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Mcmp, Matrix compare