Siemens SIMATIC S7-200 System Manual page 119

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

Advertisement

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-16
FMT Operand for the Double Integer to ASCII (DTA) Instruction
Operation of the Real to ASCII Instruction
The Real to ASCII instruction (RTA) converts a real-number
value IN to ASCII characters. The format 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.
The number (or length) of the resulting ASCII characters is the size of the output buffer and can be
specified to a size ranging from 3 to 15 bytes or characters.
The real-number format used by the S7-200 supports a maximum of 7 significant digits.
Attempting to display more than 7 significant digits produces a rounding error.
Figure 6-17 describes the format operand (FMT) for the RTA instruction. The size of the output
buffer is specified 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 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. The output buffer is filled with ASCII spaces for values of nnn
bigger than 5 or when the specified 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
the whole number and the fraction.
Figure 6-17 also shows examples of values that are formatted using a decimal point (c=0) with
one digit to the right of the decimal point (nnn=001) and a buffer size of six bytes (ssss=0110). The
output buffer 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 to the right of the decimal point are rounded to fit in the specified number of digits to
-
the right of the decimal point.
The size of the output buffer must be a minimum of three bytes more than the number of
-
digits to the right of the decimal point.
Values are right-justified in the output buffer.
-
FMT
MSB
7
6
5
4
3
s
s
s
s
c
ssss = size of output buffer
c = comma (1) or decimal point (0)
nnn = digits to right of decimal point
Figure 6-17
FMT Operand for the Real to ASCII (RTA) Instruction
Out
Out Out Out
LSB
0
in=- -12
n
in=1234567
LSB
2
1
0
n
n
n
S7-200 Instruction Set
Out
Out
Out
+1 +2
+3 +4
+5 +6
- -
0
1
2
3
Error conditions that set ENO = 0
H 0006 (indirect address)
H nnn > 5
H ssss < 3
H ssss< number of characters in OUT
Out
Out Out Out
+1
+2 +3 +4 +5
in = 1234.5
1
2
in = - -0.0004
in = - -3.67526
in = 1.95
Chapter 6
Out
Out
Out
Out Out
+7
+8 +9 +10 +11
.
0
0
1
2
.
4
5
6
7
Out
Out
3
4
.
5
0
.
0
- -
3
.
7
2
.
0
105

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents