String to REAL (STOR)

The STOR instruction converts the ASCII representation of a floating-point value to a REAL value.
The STOR instruction converts the Source to a REAL value and places the result in the Destination.
  • The instruction converts positive and negative numbers.
  • If the Source string contains non-numeric characters, the STOR converts the first set of contiguous numbers, including the decimal point [.].
The instruction skips any initial control or non-numeric characters (except the minus sign in front of a number).
If the string contains multiple groups of numbers that are separated by delimiters (e.g., /), the instruction converts only the first group of numbers.
Available Languages
Ladder Diagram
Ladder Diagram_String to REAL (STOR)_v1
FactoryTalk Design Studio
DSL - Ladder Diagram
STOR(Source,Dest);
Operands
There are data conversion rules for mixed data types within an instructions. See Data Conversion.
Ladder Diagram
Operand
Type
Format
Description
Notes
Source
String type
tag
The tag that contains the value in ASCII
String types are:
  • Default STRING data type
  • Any new string type you create
Destination
REAL
tag
The tag to store the REAL value
Affects Math Status Flags
Conditional, based on programming language.
Major/Minor Faults
Type
Code
Cause
Recovery Method
4
51
The LEN value of the string tag is greater than the DATA size of the string tag.
Check that no instruction is writing to the LEN member of the string type tag.
In the LEN value, enter the number of characters that the string contains.
4
53
The output number is beyond the limits of the destination data type.
  • Reduce the size of the ASCII value, or
  • Use a larger data type for the destination
See Index through arrays for operand-related faults.
Execution
Ladder Diagram
Condition
Ladder Diagram Action
Prescan
N/A
Rung-condition-in is false
N/A
Rung-condition-in is true
The instruction executes.
Postscan
N/A
Example
After reading the weight from a scale (weight_read is set), the STOR instruction converts the numeric characters in weight_ascii to a REAL value.
You may see a slight difference between the fractional parts of the Source and Destination.
Ladder Diagram
FTStudio STOR LD EX V1
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.