145
ST Language Configuration
Section 5-4
Data Type Conversion
Functions
The following data type conversion functions can be used in structured text.
Syntax
Source_data_type_TO_New_data_type (Variable_name)
Example: REAL_TO_INT (C)
In this example, the data type for variable C will be changed from REAL to
INT.
Data Type Combinations
The combinations of data types that can be converted are given in the follow-
ing table.
(YES = Conversion possible, No = Conversion not possible)
Number-String
Conversion Functions
The following number-string conversion functions can be used in structured
text.
Syntax
Source_data_type_TO_STRING (Variable_name)
Example: INT_TO_STRING (C)
In this example, the integer variable C will be changed to a STRING vari-
able.
STRING_TO_New_data_type (Variable_name)
Example: STRING_TO_INT (C)
REPLACE(<
Source_string
>,<
Replace_string
>,
<
Number_of_characters
>,
<
Position
>)
Source_
string
STRING
STRING
Replaces charac-
ters in a text string.
a: = REPLACE (b,c,d,e)
(*number of characters specified
by variable
d
in source string
b
replaced with text string
c
start-
ing from position specified by
variable
e
and resulting string
stored in variable
a
*)
Replace_
string
STRING
Number_of_
characters
INT,
UINT
Position
INT,
UINT
FIND(<
Source_string
>,
<
Find_string
>)
Source_
string
STRING
INT
Finds characters
within a text string.
a: = FIND (b,c)
(*first occurrence of text string
c
found in text string
b
and posi-
tion
stored in variable
a;
0 stored
if text string
c
is not found.*)
Find_string
STRING
Function
Argument data type
Return
value
data type
Description
Example
FROM
TO
BOOL
INT
DINT
LINT
UINT
UDINT
ULINT
WORD
DWORD
LWORD
REAL
LREAL
BCD_
WORD
BCD_
DWORD
BOOL
No
No
No
No
No
No
No
No
No
No
No
No
No
No
INT
No
No
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
DINT
No
YES
No
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
LINT
No
YES
YES
No
YES
YES
YES
YES
YES
YES
YES
YES
No
No
UINT
No
YES
YES
YES
No
YES
YES
YES
YES
YES
YES
YES
YES
YES
UDINT
No
YES
YES
YES
YES
No
YES
YES
YES
YES
YES
YES
YES
YES
ULINT
No
YES
YES
YES
YES
YES
No
YES
YES
YES
YES
YES
No
No
WORD
No
YES
YES
YES
YES
YES
YES
No
YES
YES
No
No
No
No
DWORD
No
YES
YES
YES
YES
YES
YES
YES
No
YES
No
No
No
No
LWORD
No
YES
YES
YES
YES
YES
YES
YES
YES
No
No
No
No
No
REAL
No
YES
YES
YES
YES
YES
YES
No
No
No
No
YES
No
No
LREAL
No
YES
YES
YES
YES
YES
YES
No
No
No
YES
No
No
No
WORD_
BCD
No
YES
YES
No
YES
YES
No
No
No
No
No
No
No
No
DWORD_
BCD
No
YES
YES
No
YES
YES
No
No
No
No
No
No
No
No
Содержание SYSMAC CX-Programmer 9
Страница 2: ......
Страница 4: ...iv ...
Страница 6: ...vi ...
Страница 8: ......
Страница 16: ...xvi ...
Страница 20: ...xx ...
Страница 26: ...xxvi Application Precautions 4 ...
Страница 27: ...Part 1 Function Blocks ...
Страница 28: ......
Страница 154: ...128 Procedures Section 3 2 ...
Страница 155: ...Part 2 Structured Text ST ...
Страница 156: ......
Страница 160: ...134 CX Programmer Specifications Section 4 2 ...
Страница 206: ...180 Procedures Section 6 1 ...
Страница 208: ...182 System defined external variables supported in function blocks Appendix A ...
Страница 230: ...204 Revision History ...
Страница 231: ......