101BExtended instructions
8.2 String and character
The IN and OUT parameters specify byte arrays and not hexadecimal String data. ASCII
characters are converted and placed in the hexadecimal output in the same order as they
are read. If there are an odd number of ASCII characters, then zeros are put in the right-
most nibble of the last converted hexadecimal digit.
Table 8- 44
ATH condition codes
RET_VAL (W#16#....)
0000
0007
Table 8- 45
Examples of ASCII-to-hexadecimal (ATH) conversion
IN character bytes
'0123'
'123AFx1a23'
'a23'
Table 8- 46
HTA instruction
LAD / FBD
SCL
ret_val := HTA(
Table 8- 47
Data types for the HTA instruction
Parameter and type
IN
IN
N
IN
RET_VAL
OUT
OUT
OUT
Conversion begins at the location specified by parameter IN and continues for N bytes. Each
4-bit nibble converts to a single 8-bit ASCII character and produces 2N ASCII character
bytes of output. All 2N bytes of the output are written as ASCII characters 0 to 9 through
uppercase A to F. The parameter OUT specifies a byte array and not a string.
Each nibble of the hexadecimal byte is converted into a character in the same order as they
are read in (left-most nibble of a hexadecimal digit is converted first, followed by the right-
most nibble of that same byte).
252
Description
No error
Invalid ATH input character
N
OUT value
4
W#16#0123
10
DW#16#123AF01023
3
W#16#A230
in:=_variant_in_,
n:=_uint_in_,
out=>_variant_out_);
Data Type
Description
Variant
Pointer to input byte array
UInt
Number of bytes to convert (each input byte has two 4-bit nibbles and
produces 2N ASCII characters)
Word
Execution condition code
Variant
Pointer to ASCII character byte array
Description
Converts packed hexadecimal digits to their corresponding ASCII
character bytes.
ENO
TRUE
FALSE
ENO
TRUE
FALSE
TRUE
S7-1200 Programmable controller
System Manual, 11/2011, A5E02486680-05