LREAL into STRING
The function LREAL_TO_STRING converts a value from the data type LREAL into a value of the data type STRING[64], 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').
Output
All input and output variables used for programming this function have been declared in the POU header.The same POU header is used for all programming languages.
VAR
lrValue: LREAL:=5.983e5;
bStart: BOOL:=FALSE;
sResult: STRING[64]:='';
END_VAR
When the variable bStart is set to TRUE, the function is carried out.
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 6 ;
NETWORK_BODY
B(B_CONTACT,,bStart,3,2,5,4,);
B(B_F,E_LREAL_TO_STRING!,,9,1,19,5,,?DEN?DIN?AENO?C);
B(B_VARIN,,lrValue,7,3,9,5,);
B(B_VAROUT,,sResult,19,3,21,5,);
L(1,0,1,6);
L(1,3,3,3);
L(5,3,9,3);
END_NETWORK_BODY
END_NET_WORK
END_BODY
if (bStart) then
sResult:=LREAL_TO_STRING(lrValue);
end_if;