Ascii Conversion Instructions - Siemens SIMATIC S7-200 System Manual

Programmable controller
Hide thumbs Also See for SIMATIC S7-200:
Table of Contents

Advertisement

ASCII Conversion Instructions

Valid ASCII characters are the hexadecimal values 30 to 39, and 41 to 46.
Converting between ASCII and Hexadecimal
Values
The ASCII to Hexadecimal instruction (ATH) converts a
number LEN of ASCII characters, starting at IN, to
hexadecimal digits starting at OUT. The Hexadecimal to
ASCII instruction (HTA) converts the hexadecimal digits,
starting with the input byte IN, to ASCII characters starting at
OUT. The number of hexadecimal digits to be converted is
specified by length LEN.
The maximum number of ASCII characters or hexadecimal
digits that can be converted is 255. Valid ASCII input
Valid ASCII input characters are alphanumeric characters 0
to 9 with a hex code value of 30 to 39, and uppercase
characters A to F with a hex code value of 41 to 46.
Error conditions that set ENO = 0
H SM1.7 (illegal ASCII) ASCII to Hexadecimal only
H 0006 (indirect address)
H 0091 (operand out of range)
SM bits affected:
H SM1.7 (illegal ASCII)
Converting Numerical Values to ASCII
The Integer to ASCII (ITA), Double Integer to ASCII (DTA),
and Real to ASCII (RTA) instructions convert integer, double
integer, or real number values to ASCII characters.
Table 6-18
Valid Operands for the ASCII Conversion Instructions
Inputs/Outputs
Data Type
IN
BYTE
INT
DINT
REAL
LEN, FMT
BYTE
OUT
BYTE
Operation of the Integer to ASCII Instruction
The Integer to ASCII instruction (ITA) converts an integer
word IN to an array of ASCII characters. The format FMT
specifies the conversion precision to the right of the decimal,
and whether the decimal point is to be shown as a comma
or a period. The resulting conversion is placed in 8
consecutive bytes beginning with OUT.
The array of ASCII characters is always 8 characters.
Operands
IB, QB, VB, MB, SMB, SB, LB, *VD, *LD, *AC
IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC,
Constant
ID, QD, VD, MD, SMD, SD, LD, AC, HC, *VD, *LD, *AC, Constant
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC, Constant
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
IB, QB, VB, MB, SMB, SB, LB, *VD, *LD, *AC
S7-200 Instruction Set
Error conditions that set ENO = 0
H 0006 (indirect address)
H Illegal format
H nnn > 5
Chapter 6
103

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents