Program instructions
7.5 Convert
S7-200 SMART
System Manual, V2.3, 07/2017, A5E03822230-AF
243
FMT operand for the double integer to ASCII (DTA) instruction
Real to ASCII
LAD / FBD
STL
Description
RTA IN, OUT, FMT
The Real to ASCII instruction converts a real-number value IN to ASCII charac-
ters. The format parameter FMT specifies the conversion precision to the right of
the decimal, whether the decimal point is shown as a comma or a period, and
the output buffer size. The resulting conversion is placed in an output buffer
beginning with OUT.
Non-fatal error conditions with ENO = 0 SM bits affected
•
0006H Invalid indirect address
•
0091H Operand out of range
•
nnn > 5
•
ssss < 3
•
ssss < number of characters in OUT
None
Input / output
Data type
Operand
IN
REAL
ID, QD, VD, MD, SMD, SD, LD, AC, *VD, *LD, *AC, Constant
FMT
BYTE
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
OUT
BYTE
IB, QB, VB, MB, SMB, SB, LB, *VD, *LD, *AC
The number (or length) of the resulting ASCII characters is the size of the output buffer and
can be assigned from 3 to 15 bytes or characters.
The real-number format supports a maximum of 7 significant digits. Attempting to display
more than 7 significant digits produces a rounding error.
The following figure describes the format operand (FMT) for the RTA instruction. The size of
the output buffer is assigned by the ssss field. A size of 0, 1, or 2 bytes is not valid. The
number of digits to the right of the decimal point in the output buffer is assigned by the nnn
field. The valid range of the nnn field is 0 to 5. If you assign 0 digits to the right of the decimal
point, then the value is converted without a decimal point. The output buffer is filled with
ASCII spaces for values of nnn greater than 5 or when the assigned output buffer is too
small to store the converted value. The c bit specifies the use of either a comma (c=1) or a
decimal point (c=0) as the separator between whole number and fraction.