beautypg.com

Delta Electronics Programmable Logic Controller DVP-PLC User Manual

Page 532

background image

9 Application Instructions API 150-199

DVP-PLC Application Manual

9-60

length of the array (n). A matrix contains 16 × n bits (points) and there is only 1 bit (point) offered for an

operand at a time.

b) The matrix instruction gathers a series of 16 × n bits (b

0

~ b

16n-1

) and designates a single point for operation.

The point will not be seen as a value.

c) The matrix instruction processes the moving, copying, comparing and searching of one-to-many or

many-to-many matrix status, which is a very handy and important application instruction.

d) The matrix operation will need a 16-bit register to designate a point among the 16n points in the matrix for the

operation. The register is the Pointer (Pr) of the matrix, designated by the user in the instruction. The vaild

range of Pr is 0 ~ 16n -1, corresponding to b0 ~ b16n-1 in the matrix.

e) There are left displacement, right displacement and rotation in a matrix operation. The bit number decreases

from left to right (see the figure below).

1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1

1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1

1

1

0 1

0 0 0

0 0 0

0 0

1 1

0 0

1

1

0 1

0 0 0

0 0 0

0 0

1 1

0 0

b0

b16

b32

b31

b15

b47

D0

D1

D2

b16n-1

1 1 1 1 1 1 1 1 1 1 0 0 0 0 1 1

Left

Right

Width: 16 bits

Dn-1

L

e

ngt

h

:

n

f) The matrix width (C) is fixed at 16 bits.

g) Pr: matrix pointer. E.g. if Pr is 15, the designated point will be b15.

h) Array length (R) is n: n = 1 ~ 256.

Example: The matrix is composed of D0, n = 3; D0 = HAAAA, D1 = H5555, D2 = HAAFF

C

15

C

14

C

13

C

12

C

11

C

10

C

9

C

8

C

7

C

6

C

5

C

4

C

3

C

2

C

1

C

0

R

0

1 0 1

0 1 0 1

0

1

0

1

0

1

0

1 0 D0

R

1

0 1 0

1 0 1 0

1

0

1

0

1

0

1

0 1 D1

R

2

1 0 1

0 1 0 1

0

1

1

1

1

1

1

1 1 D2

Example: The matrix is composed of K2X0, n = 3; K2X0 = H37, K2X10 = H68, K2X20 = H45

C

15

C

14

C

13

C

12

C

11

C

10

C

9

C

8

C

7

C

6

C

5

C

4

C

3

C

2

C

1

C

0

R

0

0 0 0

0 0 0 0

0

0

0

1

1

0

1

1 1 X

0

~X

7

R

1

0 0 0

0 0 0 0

0

0

1

1

0

1

0

0 0 X

10

~X

17

R

2

0 0 0

0 0 0 0

0

0

1

0

0

0

1

0 1 X

20

~X

27

Fill “0” into the blank in R0(C

15

-C

8

), R1(C

15

-C

8

), and R2(C

15

-C

8

).