Ath And Hta (Convert To/From Ascii String And Hexadecimal Number) Instructions - Siemens S7-1200 System Manual

Hide thumbs Also See for S7-1200:
Table of Contents

Advertisement

Extended instructions
8.2 String and character
Table 8- 39
ENO status
ENO
Description
1
No error
0
Chars_TO_Strg: Attempt to copy more character bytes to the output string than allowed by the maximum
length byte in the string declaration
0
Chars_TO_Strg: The nul character (16#00) value was found in the input character byte array.
0
Strg_TO_Chars: Attempt to copy more character bytes to the output array than are allowed by the element
number limit
8.2.3.3

ATH and HTA (Convert to/from ASCII string and hexadecimal number) instructions

Use the ATH (ASCII to hexadecimal) and HTA (hexadecimal to ASCII) instructions for
conversions between ASCII character bytes (characters 0 to 9 and uppercase A to F only)
and the corresponding 4-bit hexadecimal nibbles.
Table 8- 40
ATH instruction
LAD / FBD
SCL
ret_val := ATH(
in:=_variant_in_,
n:=_int_in_,
out=>_variant_out_);
Table 8- 41
Data types for the ATH instruction
Parameter type
IN
IN
N
IN
RET_VAL
OUT
OUT
OUT
Conversion begins at the location specified by parameter IN and continues for N bytes. The
result is placed at the location specified by OUT. Only valid ASCII characters 0 to 9, lower
case a to f, and uppercase A to F can be converted. Any other character will be converted to
zero.
8-bit ASCII coded characters are converted to 4-bit hexadecimal nibbles. Two ASCII
characters can converted into a single byte containing two 4-bit hexadecimal nibbles.
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.
304
Description
Converts ASCII characters into packed hexadecimal digits.
Data Type
Description
Variant
Pointer to ASCII character byte array
UInt
Number of ASCII character bytes to convert
Word
Execution condition code
Variant
Pointer to the converted hexadecimal byte array
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG

Advertisement

Table of Contents
loading

Table of Contents