Structured Text (ST Language) Specifications
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)
FROM
BOOL
INT
BOOL
No
No
INT
No
No
DINT
No
YES
LINT
No
YES
UINT
No
YES
UDINT
No
YES
ULINT
No
YES
WORD
No
YES
DWORD
No
YES
LWORD
No
YES
REAL
No
YES
No
YES
LREAL
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;
144
DINT
LINT
UINT
No
No
No
YES
YES
YES
No
YES
YES
YES
No
YES
YES
YES
No
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
TO
UDINT
ULINT
WORD
No
No
No
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
No
YES
YES
YES
No
YES
YES
YES
No
YES
YES
YES
YES
YES
YES
YES
YES
No
YES
YES
No
Appendix B
DWORD LWORD
REAL
No
No
No
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
YES
No
No
YES
No
YES
No
No
No
No
No
No
No
YES
LREAL
No
YES
YES
YES
YES
YES
YES
No
No
No
YES
No
Need help?
Do you have a question about the CX-PROGRAMMER 5.0-FUNCTION BLOCK OPERATION and is the answer not in the manual?