ANY_TO_STRING

The ANY_TO_STRING instruction converts a value to a String value.
Operation details:
  • When converting a REAL data type to a String, the ANY_TO_STRING instruction uses the IEEE 754 format.
    • ANY_TO_STRING converts 125.0 to 1.25000E+02.
  • When the target string length is 5 characters:
    • ANY_TO_STRING converts 125.0 to 1.25000E+02 and outputs 1.250 to the target string.
    • Consider creating a user-defined function block to convert from Exponential notation to number.
Languages supported: Function block diagram, ladder diagram, structured text.
This instruction applies to the Micro810, L20E, L50E, and L70E controllers.
ANY_TO_STRING
ANY_TO_STRING
ANY_TO_STRING parameters
Parameter
Parameter Type
Data Type
Description
EN
Input
BOOL
When set to true, the instruction is enabled.
  • TRUE: Execute the current computation.
  • FALSE: There is no computation.
Applies to ladder diagram programs.
i1
Input
BOOL
SINT
USINT
BYTE
INT
UINT
WORD
DINT
UDINT
DWORD
LINT
ULINT
LWORD
REAL
LREAL
TIME
DATE
Any value other than String.
o1
Output
STRING
If IN is a Boolean, 'FALSE' or 'TRUE'.
If IN is an Integer or a Real, a decimal representation.
If IN is a TIME, can be:
  • TIME time1
  • STRING s1
  • time1 :=13 ms;
  • s1:=ANY_TO_STRING(time1);
  • (* s1 = '0s13' *).
ENO
Output
BOOL
Enables output. Applies to ladder diagram programs.

ANY_TO_STRING structured text example

(* ST Equivalence: *)
bres := ANY_TO_STRING (TRUE);
(* bres is 'TRUE' *)
ares := ANY_TO_STRING (125);
(* ares is '125' *)
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.
Normal