ASCII to Hex, Hex to ASCII Convert

Inputs/Outputs Operands Data Types
IN, OUT VB, IB, QB, MB, SMB, LB, *VD, *AC, SB, *LD BYTE
LEN VB, IB, QB, MB, SMB, LB, AC, Constant, *VD, *AC, SB, *LD BYTE

Memory Ranges ENO Errors Instruction Support for S7-200 CPUs SIMATIC/International Mnemonics
The ASCII to HEX (ATH) instruction converts the ASCII string of length (LEN), starting at IN, to hexadecimal digits starting at OUT. The maximum length of the ASCII string is 255 characters.

The HEX to ASCII (HTA) instruction converts the hexadecimal digits, starting with the input byte (IN), to an ASCII string starting at OUT. The number of hexadecimal digits to be converted is specified by length (LEN). The maximum number of the hexadecimal digits that can be converted is 255.

Legal ASCII characters are the hexadecimal values 30 to 39, and 41 to 46.

ASCII to HEX: Error Conditions that Set ENO = 0:

0006 (indirect address), 0091 (operand out of range), SM1.7 (illegal ASCII), SM4.3 (run-time)

Hex to ASCII: Error Conditions that Set ENO = 0:

0006 (indirect address), 0091 (operand out of range), SM4.3 (run-time)

These instructions affect the following Special Memory bits:

SM1.7 (illegal ASCII)


Example