beautypg.com

Function sample program, 2 instructions, Bcdl – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 224

background image

2 Instructions

2-188

CP1E CPU Unit Instructions Reference Manual(W483)

Function

Sample program

When CIO 0.00 is ON in the following example, the hexadecimal value in CIO 11 and CIO 10 is con-
verted to a BCD value and stored in D100 and D101.

BCD

BCD(024) converts the binary data in S to BCD data
and writes the result to R.

The following diagram shows an example BCD-to-binary conversion.

BCDL

BCDL(059) converts the 8-digit hexadecimal (32-bit
binary) data in S and S+1 to 8-digit BCD data and
writes the result to R and R+1.

The following diagram shows an example of 8-digit BCD-to-binary conversion.

(BIN)

(BCD)

R

S

Ч16

3

Ч16

2

Ч16

1

Ч16

0

R

S

1

0

E

C

4

3

3

2

0

3

4

7

8

11

12

15

0

3

4

7

8

11

12

15

Ч10

3

Ч10

2

Ч10

1

Ч10

0

R

R+1

(BCD)

(BCD)

S+1

S

(BIN)

(BIN)

Ч10

3

Ч10

2

Ч10

1

Ч10

0

Ч10

7

Ч10

6

Ч10

5

Ч10

4

S+1

S

R+1

R

0

0

D

3

2

A

0

2

0

2

6

1

9

0

3

9

Ч16

3

Ч16

2

Ч16

1

Ч16

0

Ч16

7

Ч16

6

Ч16

5

Ч16

4

BCDL

10

D100

0.00

0

Ч

16

7

0

Ч

16

6

2

Ч

16

5

D

Ч

16

4

3

Ч

16

3

2

Ч

16

2

0

Ч

16

1

A

Ч

16

0

2

Ч

16

5

13

Ч

16

4

3

Ч

16

3

2

Ч

16

2

10 2961930

0

Ч

10

7

2

Ч

10

6

9

Ч

10

5

6

Ч

10

4

1

Ч

10

3

9

Ч

10

2

3

Ч

10

1

0

Ч

10

0

MBS

MBS

LSB

LSB

S+1 : CIO 11

S: CIO 10

R+1 : D101

R : D100

This manual is related to the following products: