508
Conversion Instructions Section 3-12
3-12-11ASCII TO HEX: HEX(162)
Purpose 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.
Ladder Symbol
Variations
Applicable Program Areas
Operands S: First Source Word
The contents of the source words are treated as ASCII data. Up to three
source words can be used. (Three source words will be required if 4 bytes are
being converted and the leftmost byte is selected as the first byte in S.) The
source words must be in the same data area.
Di: Digit Designator
The digit designator specifies various parameters for the conversion, as
shown in the following diagram.
D: Destination word
The converted hexadecimal digits are written into D from right to left, begin-
ning with the specified first digit. Any digits in the destination word that are not
overwritten with the converted data will be left unchanged.
HEX(162)
S
D
Di
S: First source word
Di: Digit designator
D: Destination word
Variations Executed Each Cycle for ON Condition HEX(162)
Executed Once for Upward Differentiation @HEX(162)
Executed Once for Downward Differentiation Not supported
Immediate Refreshing Specification Not supported
Block program areas Step program areas Subroutines Interrupt tasks
OK OK OK OK
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.