405
3. Instructions
CS/CJ/NSJ Series Instructions Reference Manual (W474)
Conversion Instructions
3
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
Function block
definitions
Block program areas Step program areas Subroutines Interrupt tasks
SFC action or
transition programs
Usage OK OK OK 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
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.
8
15
Leftmost byte Rightmost byte
07
D
The results of conversion to hex are stored
from the starting digit going left (returns to
digit 0 after digit 3)
Digit 3 Digit 2
8
111215
Digit 1 Digit 0
03
47
3 2 1 0Digit number:
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.