Siemens SIMATIC S7-200 System Manual page 122

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

Advertisement

S7-200 Programmable Controller System Manual
FMT
MSB
7
6
5
4
0
0
0
0
c = comma (1) or decimal point (0)
nnn = digits to right of decimal point
Figure 6-18
FMT Operand for the Integer to String Instruction
Operation of the Double Integer to String
The Double Integer to String instruction (DTS) converts a
double integer IN to an ASCII string with a length of 12
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 13 consecutive bytes starting at
OUT. For more information, see the section that describes
the format for strings in Chapter 4.
Figure 6-19 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 12 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-19 also shows examples of values that are formatted using a decimal point (c= 0) with
four digits to the right of the decimal point (nnn = 100). 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.
-
FMT
MSB
7
6
5
4
3
2
1
0
0
0
0
c
n
n
c = comma (1) or decimal point (0)
nnn = digits to right of decimal point
Figure 6-19
FMT Operand for the Double Integer to String Instruction
108
LSB
3
2
1
0
c
n
n
n
Out
LSB
0
in=12
12
n
in=- -1234567
12
Out
Out Out Out
+1
+2
in=12
8
in=- -123
8
8
in=1234
in = - -12345
8
- -
Error conditions that set ENO = 0
H 0006 (indirect address)
H 0091 (operand out of range)
H Illegal format (nnn > 5)
Out Out Out
Out
Out
Out
+1
+2
+3
+4
+5
.
1
Out
Out
Out
Out
Out
+3
+4
+5
+6
+7
+8
0
.
.
0
1
0
.
.
1
2
1
.
2
3
.
1
2
3
4
Out
Out
Out
Out
Out
+6
+7
+8
+9
+10
+11
- -
0
.
0
0
1
2
3
.
4
5
6
2
3
4
5
Out
+12
2
7

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents