beautypg.com

Sample program, 2 instructions, Example of ascii code conversion – Omron SYSMAC CP CP1E-N@@D@-@ User Manual

Page 239

background image

2-203

2 Instructions

CP1E CPU Unit Instructions Reference Manual(W483)

Con

v

e

rs

ion I

n

stru

ctio

ns

2

ASC

Sample program

When CIO 0.00 is ON in the following example, ASC(086) converts three hexadecimal digits in D100
(beginning with digit 1) into their ASCII equivalents and writes this data to D200 and D201 beginning
with the leftmost byte in D200. In this case, a digit designator of #0121 specifies no parity, the starting
byte (when writing) = leftmost byte, the number of digits to read = 3, and the starting digit (when read-
ing) = digit 1.

Example of ASCII code conversion

* Parity bit - changes according to the parity specification.

Content of conversion data digits

Conversion output data

Value

Bit content

Code

(MSB) bit content (LSB)

0

0

0

0

0

#30

*

0

1

1

0

0

0

0

1

0

0

0

1

#31

*

0

1

1

0

0

0

1

2

0

0

1

0

#32

*

0

1

1

0

0

1

0

3

0

0

1

1

#33

*

0

1

1

0

0

1

1

4

0

1

0

0

#34

*

0

1

1

0

1

0

0

5

0

1

0

1

#35

*

0

1

1

0

1

0

1

6

0

1

1

0

#36

*

0

1

1

0

1

1

0

7

0

1

1

1

#37

*

0

1

1

0

1

1

1

8

1

0

0

0

#38

*

0

1

1

1

0

0

0

9

1

0

0

1

#39

*

0

1

1

1

0

0

1

A

1

0

1

0

#41

*

1

0

0

0

0

0

1

B

1

0

1

1

#42

*

1

0

0

0

0

1

0

C

1

1

0

0

#43

*

1

0

0

0

0

1

1

D

1

1

0

1

#44

*

1

0

0

0

1

0

0

E

1

1

1

0

#45

*

1

0

0

0

1

0

1

F

1

1

1

1

#46

*

1

0

0

0

1

1

0

D: D200

D201

ASC

D100

#0121

D200

0.00

S

Di

D

0

3

4

7

8

15

12 11

0

3

4

7

8

15

12 11

1

2

1

0

0

1

2

3

3

2

1

0

7

8

15

33

32

31

S: D100

Di: #

Number of digits

Digits

HEX

ASCII

Starting digit

Starting byte
(leftmost byte)

This manual is related to the following products: