Block that performs the conversion of a STRING value into a REAL value.
Ladder Representation
![]()
Block Structure
Tipo |
Name |
Data Type |
Description |
VAR_INPUT |
EN |
BOOL |
Block enabling |
STR |
STRING |
Value in STRING |
|
VAR_OUTPUT |
DONE |
BOOL |
End of operation |
OUT |
REAL |
Value in REAL |
Operation
When this block has a TRUE value in EN, it reads the value of STR as STRING character by character, performing the conversion to REAL and storing in DONE. If the first character is not mathematically valid, the OUT output receives zero. If there are valid characters, these characters will be converted to the end of STRING, or until it finds an invalid character.
|
NOTE! The block interprets the dot (.) as a decimal tab, and not the comma (,). |
When EN has FALSE value, OUT remains unchanged and DONE remains FALSE.
The DONE value forwards to the next Ladder block the EN value after the operation is completed.
Compatibility
Device |
Version |
PLC300 |
2.10 or higher |
Block Flowchart

Example in Ladder
The following examples show various conversions of STRING into values of REAL type. All conversions enable the DONE output to the end of the operation.

The conversion above was successfully completed. The decimal point is a valid mathematical character.

The conversion above was successfully completed. The dash and decimal point are valid mathematical characters.

The conversion above was successfully completed. The dash and the power indicator of 10 "and" are valid mathematical characters.

The conversion above was not successfully completed. The first character was not identified as mathematically valid, and the output was zeroed.

The conversion above was successfully completed. The "p" character is not mathematically valid and ends the conversion, truncating the result to what had already been converted.
Example in ST
The example below displays the instructions for applying the example above in the ST language.
VAR STR : STRING := '105p0'; OUT : REAL; END_VAR
OUT := FB_STRING_TO_REAL(EN:=DI1, STR:=STR, DONE=>DO1);
|
|---|