SIMATIC Instructions
The format operand (FMT) for the RTA instruction is defined in Figure 9-50. 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. The output buffer is
formatted in accord with the following rules:
1.
Positive values are written to the output buffer without a sign.
2.
Negative values are written to the output buffer with a leading minus sign (-).
3.
Leading zeros to the left of the decimal point (except the digit adjacent to the
decimal point) are suppressed.
4.
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.
5.
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.
6.
Values are right-justified in the output buffer.
Figure 9-50 gives 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).
MSB
7
6
5
s
s
s
ssss = size of output buffer
c = comma (1) or decimal point (0)
nnn = digits to right of decimal point
Figure 9-50
Note
The floating point format used by the S7-200 CPU supports a maximum of 7
significant digits. Attempting to display more than the 7 significant digits produces
a rounding error.
9-144
LSB
4
3
2
1
0
s
c
n
n
n
in = 1234.5
in = -0.0004
in = -3.67526
in = 1.95
FMT Operand for RTA Instruction
Out
Out Out Out
Out
Out
+1
+2
+3 +4
+5
1
2
3
4
.
5
.
0
0
-
3
.
7
.
2
0
S7-200 Programmable Controller System Manual
A5E00066097-02