Panasonic FP Series Programming Manual page 230

Hide thumbs Also See for FP Series:
Table of Contents

Advertisement

REAL_TO_STRING
The function REAL_TO_STRING converts a value from the data type REAL into a value of the data
Description
type STRING[15], which has 7 spaces both before and after the decimal point. The resulting string
is right justified within the range '-999999.0000000' to '9999999.0000000'. The plus sign is omitted
in the positive range. Leading zeros are filled with empty spaces (e.g. out of -12.0 the STRING '
-12.0').
To add an enable input and enable output to the instruction, select [With EN/ENO] from the
"Instructions" pane (LD, FBD or IL editor). To reuse an instruction select "Recently used" from the
context menu or press <Ctrl>+<Shift>+<v> in the programming window.
 The function requires approximately 160 steps of program memory.
For repeated use you should integrate it into a user function that is
only stored once in the memory.
 When using the data type STRING with small PLCs like FP-e or FP0,
make sure that the length of the result string is equal to or greater than
the length of the source string.
 For further information refer to the online help: Upgrade Problems with
Data Type STRING
Availability of REAL_TO_STRING (see page 1330)
PLC types
Data types
Data type
REAL
STRING
In this example, the same POU header is used for all programming languages. For an example
Example
using IL (instruction list), please refer to the online help.
POU header
In the POU header, input and output variables are declared that are used in the function.
The input variable input_value of the data type REAL is intialized by the value -123.4560166. The
output variable result_string is of the data type STRING[15]. It can store a maximum of 15
characters. Instead of using the variable input_value, you can enter a constant directly at the
function's input contact in the body.
Body
The input_value of the data type REAL is converted into STRING[15]. The converted value is
written to result_string. When the variable input_value = 123.4560166, result_string shows '
-123.4560165'.
LD
REAL into STRING
I/O
Function
input
input data type
output
conversion result
Conversion instructions
229

Advertisement

Table of Contents
loading

Table of Contents