144
Structured Text (ST Language) Specifications
Appendix B
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 following table.
(YES = Conversion possible, No = Conversion not possible)
Statement Details
Assignment
Summary
The left side of the statement (variable) is substituted with the right side of the statement (equation, variable, or
constant).
Reserved Words
:=
Combination of colon (:) and equals sign (=).
Statement Syntax
Variable:
=
Equation, variable, or constant
;
Usage
Use assignment statements for inputting values in variables. This is a basic statement for use before or within
control statements. This statement can be used for setting initial values, storing calculation results, and incre-
menting or decrementing variables.
Description
Substitutes (stores) an
equation
,
variable
, or
constant
for the
variable
.
Examples
Example 1: Substitute variable A with the result of the equation X+1.
A:=X+1;
Example 2: Substitute variable A with the value of variable B.
A:=B;
FROM
TO
BOOL
INT
DINT
LINT
UINT
UDINT
ULINT
WORD
DWORD
LWORD
REAL
LREAL
BOOL
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
DINT
No
YES
No
YES
YES
YES
YES
YES
YES
YES
YES
YES
LINT
No
YES
YES
No
YES
YES
YES
YES
YES
YES
YES
YES
UINT
No
YES
YES
YES
No
YES
YES
YES
YES
YES
YES
YES
UDINT
No
YES
YES
YES
YES
No
YES
YES
YES
YES
YES
YES
ULINT
No
YES
YES
YES
YES
YES
No
YES
YES
YES
YES
YES
WORD
No
YES
YES
YES
YES
YES
YES
No
YES
YES
No
No
DWORD
No
YES
YES
YES
YES
YES
YES
YES
No
YES
No
No
LWORD
No
YES
YES
YES
YES
YES
YES
YES
YES
No
No
No
REAL
No
YES
YES
YES
YES
YES
YES
No
No
No
No
YES
LREAL
No
YES
YES
YES
YES
YES
YES
No
No
No
YES
No
Summary of Contents for CS1-H Series
Page 3: ...iv...
Page 5: ...vi...
Page 7: ...viii TABLE OF CONTENTS...
Page 15: ...xvi Application Precautions 4...
Page 151: ...136 Procedures Section 3 2...
Page 153: ...138 Data Types Appendix A...
Page 177: ...162 External Variables Appendix C...
Page 181: ...166 Revision History...