Omron CP1E-NA@@D@-@ Computer Hardware User Manual


 
2-205
2 Instructions
CP1E CPU Unit Instructions Reference Manual(W483)
Conversion Instructions
2
HEX
HEX
Applicable Program Areas
Operands
DI: Digit Designator
The digit designator specifies various parameters for the conversion, as shown in the following dia-
gram.
Instruction Mnemonic Variations
Function
code
Function
ASCII TO HEX HEX @HEX 162
Converts up to 4 bytes of ASCII data in the source
word to their hexadecimal equivalents and writes
these digits in the specified destination word.
Symbol
HEX
Area Step program areas Subroutines Interrupt tasks
Usage OK OK OK
Operand Description Data type Size
S First source word UINT Variable
DI Digit designator UINT 1
D Destination word UINT 1
S: First Source Word D: Destination Word
S: First source word
DI: Digit designator
D: Destination word
HEX(162)
S
DI
D
S
815
Leftmost byte Rightmost byte
07
The conversion start byte and bytes to the left are
treated as ASCII code and converted to hex (returns
to the rightmost byte after the leftmost byte.
D
Digit 3 Digit 2
811
1215
Digit 1 Digit 0
03
47
The results of conversion to hex are stored
from the starting digit going left (returns to
digit 0 after digit 3)
Digit number: 3 2 1 0
Specifies the first digit in D to receive converted data (0 to 3).
Number of bytes to be converted (0 to 3)
0: 1 digit
1: 2 digits
2: 3 digits
3: 4 digits
0: Rightmost byte
1: Leftmost byte
Parity 0: None
1: Even
2: Odd
First byte of S to be converted.