beautypg.com

Delta DVP-ES2 User Manual

Page 529

background image

3 . I n s t r u c t i o n S e t

3 - 4 1 3

API Mnemonic

Operands

Function

185

MCMP

P

Matrix 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

*

*

*

*

*

*

*

n

*

*

*

D

*

*

*

*

*

*

*

*

MCMP, MCMPP: 9 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

: Matrix source device 1 S

2

: 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 S

1

and matrix S

2

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 S

1,

S

2,

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.

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

This manual is related to the following products: