Number Value To Ascii String Conversion - Siemens Simatic S7 Series System Manual

Hide thumbs Also See for Simatic S7 Series:
Table of Contents

Advertisement

Program instructions
7.5 Convert
7.5.3

Number value to ASCII string conversion

Format of the STRING data type
A string variable is a sequence of characters, with each character stored as a byte. The first
byte of the STRING data type defines the length of the string, which is the number of
character bytes.
The diagram below shows the STRING data type stored as a variable in memory. The string
can have a length of 0 to 254 characters. The maximum storage requirement for a variable
string is 255 bytes (the length byte plus 254 characters).
If a constant string parameter is entered directly in the program editor (126 characters
maximum) or a variable string is initialized in the data block editor (254 characters
maximum), the string assignment must begin and end with double quote characters.
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.
208
System Manual, 09/2015, A5E03822230-AC
S7-200 SMART

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Simatic s7-200 smart series

Table of Contents