String Conversion Instructions - Siemens SIMATIC S7-200 System Manual

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

Advertisement

String Conversion Instructions

Converting Numerical Values to String
The Integer to String (ITS), Double Integer to String (DTS),
and Real to String (RTS) instructions convert integers,
double integers, or real number values (IN) to an ASCII
string (OUT).
Operation of the Integer to String
The Integer to String instruction (ITS) converts an integer
word IN to an ASCII string with a length of 8 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 string is
written to 9 consecutive bytes starting at OUT. See the
section, format for strings in Chapter 4 for more information.
Error conditions that set ENO = 0
H 0006 (indirect address)
H 0091 (operand out of range)
H Illegal format (nnn > 5)
Figure 6-18 describes the format operand for the Integer to
String instruction. 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 specified by the nnn field. The
valid range of the nnn field is 0 to 5. Specifying 0 digits to
the right of the decimal point causes the value to be
displayed 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 the whole
number and the fraction. The upper 4 bits of the format must
be zero.
Figure 6-18 also shows examples of values that are formatted using a decimal point (c= 0) with
three digits to the right of the decimal point (nnn = 011).The value at OUT is the length of the
string.
The output string is formatted according to the following rules:
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.
-
Table 6-19
Valid Operands for the Instructions That Convert Numerical Values to Strings
Inputs/Outputs
Data Type
IN
INT
DINT
REAL
FMT
BYTE
OUT
STRING
Operands
IW, QW, VW, MW, SMW, SW, T, C, LW, 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
VB, LB, *VD, *LD, *AC
S7-200 Instruction Set
Chapter 6
107

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents