beautypg.com

Flags function precautions, Sample program, 2 instructions – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 150: Example of transferring multiple digits

background image

2 Instructions

2-114

CP1E CPU Unit Instructions Reference Manual(W483)

Flags

Function

Precautions

If the number of digits being read or written exceeds the leftmost digit of S or D, MOVD(083) will wrap to
the rightmost digit of the same word.

Sample program

When CIO 0.00 is ON in the following example, four digits of data are copied from W0 to W100. The trans-
fer begins with the digit 1 of W0 and digit 0 of W100, in accordance with the control word’s value of 31.

Note After reading the leftmost digit of S (digit 3), MOVD(083) wraps to the rightmost digit (digit 0).

Example of transferring multiple digits

The following diagram shows examples of data transfers for various values of C.

Name

Label

Operation

Error Flag

P_ER

ON if one of the first three digits of C is not within the specified range of 0 to 3.

OFF in all other cases.

MOVB(082) copies the specified bit (n) from S
to the specified bit (m) in D. The other bits in
the destination word are left unchanged.

S

m

n

D

R

C

0

R

8

11

12

15

n

m

0

3

4

7

MOVD

W0

D300

W100

0.00

S

C

D

C D300

0

0

8

11

12

15

3

1

0

3

4

7

D: W100

4

1

8

11

12

15

2

3

3

2

1

0

3

2

1

0

0

3

4

7

S: W0

1

2

8

11

12

15

3

4

0

3

4

7

Digit no.

Digit no.

First digit in D: Digit 0

Number of digits: 3 (4 digits)

First digit in S: Digit 1

S

C

㧦211

D

S

C

㧦30

D

S

C

㧦312

D

S

C

㧦230

D

Digit 0

Digit 1

Digit 2

Digit 3

Digit 0

Digit 1

Digit 2

Digit 3

Digit 0

Digit 1

Digit 2

Digit 3

Digit 0

Digit 1

Digit 2

Digit 3

Digit 0

Digit 1

Digit 2

Digit 3

Digit 0

Digit 1

Digit 2

Digit 3

Digit 0

Digit 1

Digit 2

Digit 3

Digit 0

Digit 1

Digit 2

Digit 3

This manual is related to the following products: