EasyManua.ls Logo

Siemens S7-1200 - Page 305

Siemens S7-1200
1028 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Extended instructions
8.2 String and character
S7-1200 Programmable controller
System Manual, 03/2014, A5E02486680-AG
305
Table 8- 42 Examples of ASCII-to-hexadecimal (ATH) conversion
IN character bytes
N
OUT value
ENO
'0a23'
4
W#16#0A23
TRUE
'123AFx1a23'
10
16#123AF01023
FALSE
'a23'
3
W#16#A230
TRUE
Table 8- 43 HTA instruction
LAD / FBD
SCL
Description
ret_val := HTA(
in:=_variant_in_,
n:=_uint_in_,
out=>_variant_out_);
Converts packed hexadecimal digits to their corresponding ASCII
character bytes.
Table 8- 44 Data types for the HTA instruction
Parameter and type
Data Type
Description
IN
IN
Variant
Pointer to input byte array
N IN UInt Number of bytes to convert (each input byte has two 4-bit nibbles and
produces 2N ASCII characters)
RET_VAL
OUT
Word
Execution condition code
OUT
OUT
Variant
Pointer to ASCII character byte array
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).
Table 8- 45 Examples of hexadecimal -to- ASCII (HTA) conversion
IN value
N
OUT character bytes
ENO (ENO always TRUE after HTA execution)
W#16#0123
2
'0123'
TRUE
DW#16#123AF012
4
'123AF012'
TRUE
Table 8- 46 ATH and HTA condition codes
RET_VAL
(W#16#....)
Description
ENO
0000
No error
TRUE
0007 Invalid ATH input character: A character was found that was not an ASCII character 0-
9, lowercase a to f, or uppercase A to F
FALSE

Table of Contents

Other manuals for Siemens S7-1200

Related product manuals