DVP-ES2/EX2/SS2/SA2/SX2/SE Operation Manual - Programming

API

83

Mnemonic

 

Operands

Function

 

 

 

 

 

 

 

HEX

 

P

 

Convert ASCII to HEX

 

 

 

 

 

 

Controllers

ES2/EX2 SS2 SA2 SX2

SE

Type

 

Bit Devices

 

 

 

 

 

Word devices

 

 

 

 

 

 

Program Steps

 

OP

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X

Y

M

S

K

H

KnX

KnY

KnM

KnS

T

C

D

E

 

F

HEX, HEXP: 7 steps

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S

 

 

 

 

 

*

*

*

*

 

 

*

*

 

*

 

*

*

 

 

 

 

 

 

 

 

 

D

 

 

 

 

 

 

 

 

 

*

 

 

*

*

 

*

 

*

*

 

 

 

 

 

 

 

 

 

n

 

 

 

 

 

*

*

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

PULSE

 

 

 

 

 

16-bit

 

 

32-bit

 

 

 

 

 

 

 

 

 

 

ES2/EX2

SS2

SA2

SX2

 

ES2/EX2

SS2

SA2

SX2

ES2/EX2

SS2

SA2

SX2

 

 

 

 

 

 

 

 

 

SE

 

SE

SE

Operands:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S: Source device

D: Destination device

 

 

n: number of bytes to be converted (n = 1~256)

 

Explanations:

1.16-bit conversion mode: When M1161 = OFF, the instruction converts n bytes of ASCII codes starting from S into Hex data in byte mode and send them to high byte and low byte of D. n = the converted number of bytes.

2.8-bit conversion mode: When M1161 = ON, the instruction converts n bytes (low bytes only) of ASCII codes starting from S into Hex data in byte mode and send them to the low byte of D. n = the converted number of bytes. (All higher 8 bits of D = 0)

3.Flag: M1161 (8/16 bit mode switch)

4.Available range for Hex data: 0~9, A~F

Program Example 1:

1.M1161 = OFF: 16-bit conversion.

2.When X0 = ON, convert 4 bytes of ASCII codes stored in registers D20~ D21 into Hex value and send the result in byte mode to register D10. n = 4

 

 

M1001

M1161

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

X0

HEX

D20

D10

K4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

3. Assume:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

S

ASCII code

HEX

 

S

ASCII code

HEX

 

 

 

conversion

 

conversion

 

 

 

 

 

 

 

 

 

 

 

D20 low byte

H 43

 

“C”

 

D24 low byte

H 34

“4”

 

D20 high byte

H 44

 

“D”

 

D24 high byte

H 35

“5”

 

D21 low byte

H 45

 

“E”

 

D25 low byte

H 36

“6”

 

D21 high byte

H 46

 

“F”

 

D25 high byte

H 37

“7”

 

D22 low byte

H 38

 

“8”

 

D26 low byte

H 30

“0”

 

D22 high byte

H 39

 

“9”

 

D26 high byte

H 31

“1”

 

D23 low byte

H 41

 

“A”

 

D27 low byte

H 32

“2”

 

D23 high byte

H 42

 

“B”

 

D27 high byte

H 33

“3”

3 - 232

Page 348
Image 348
Delta DVP-ES2/EX2/SS2/SA2/SX2/SE manual Convert Ascii to HEX, Ascii code, Conversion