Program instructions
7.5 Convert
S7-200 SMART
246 System Manual, V2.3, 07/2017, A5E03822230-AF
ASCII output number format
● Positive values are written to the output buffer without a sign.
● Negative values are written to the output buffer with a leading minus sign (-).
● Leading zeros to the left of the decimal point (except the digit adjacent to the decimal
point) are suppressed.
● Values are right-justified in the output string.
● Real numbers: Values to the right of the decimal point are rounded to fit in the specified
number of digits to the right of the decimal point.
● Real numbers: The size of the output string must be a minimum of three bytes more than
the number of digits to the right of the decimal point.
Integer to string conversion
The Integer to String instruction converts an integer word IN to an ASCII
string with a length of 8 characters. The format (FMT) assigns the conver-
sion precision to the right of the decimal, and whether the decimal point is
to be shown as a comma or a period. The resulting string is written to 9
consecutive bytes starting at OUT.
Non-fatal error conditions with ENO = 0
• 0006H indirect address
• 0091H operand out of range
• Illegal format (nnn > 5)
• FMT bit is not zero for the four most signif-
icant bits of the FMT byte
None
IN INT IW, QW, VW, MW, SMW, SW, T, C, LW, AC, AIW, *VD, *LD, *AC, Con-
IB, QB, VB, MB, SMB, SB, LB, AC, *VD, *LD, *AC, Constant
The length of the output string is always 8 characters. 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. For values of nnn greater than 5, the output is a string of
8 ASCII space characters. 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. The most significant 4 bits
of the format must be zero.