Introduction
After inserting an
double-click the displayed question marks ( ) to enter the ST assignment expression.Confirming with
will start an analysis and the found detected problems will be displayed in a tooltip.Animation of the memory words used inside the ST assignment expression can be seen in a Variable Display Window.
. Please refer toMemory Addresses
A memory address entered in the ST assignment expression must start with one of the following symbols, specifying the address type:
%M (memory bit)
%I (discrete input)
%IW (input word)
%MW (memory word)
The address type must be followed by an address number (no leading zeros required).
Creating Variables Automatically
After confirming the ST assignment expression with
, for every entered address a variable will be created automatically, which is used in the equation network.Examples
Address |
Variable |
---|---|
%M1 |
|
%I1 |
|
%IW1 |
|
%MW1 |
|
The variable type is derived from its address suffix.
Suffix |
Variable Type |
|
---|---|---|
no suffix |
%Mx, %Ix |
EBOOL |
%IWx, %MWx |
UINT |
|
I |
INT |
|
DI |
DINT |
|
UD |
UDINT |
|
R |
REAL |
|
W |
WORD |
The variable is mapped to the associated internal located memory.
For example: %IW1DI becomes the variable _300001_DI:DINT@%IW1
.
Constants
Constants in equation networks have the same syntax as in other IEC editors (that is without a leading # character).
Operators
Operators and their precedence
Operation |
Symbol |
Precedence |
---|---|---|
Parentheses |
(expression) |
HIGHEST |
Function evaluation |
identifier (argument list) |
- |
Negation |
- |
- |
Complement |
~ |
- |
Exponentiation |
** |
- |
Multiply |
* |
- |
Divide |
/ |
- |
Add |
+ |
- |
Subtract |
- |
- |
Comparison |
< , > , <= , >= |
- |
Equality |
= |
- |
Inequality |
<> |
- |
Boolean AND |
& |
- |
Boolean Exclusive OR |
^ |
- |
Boolean OR |
| |
- |
Assignment |
:= |
LOWEST |
The operators **, *, /, +, -, <<, >>, <, >, <=, >=, =, <>, &, ^ and | are supported as they are implemented now in Control Expert ST syntax. That is not all data type combinations for operand types and the result type are supported.
Ternary Conditional
Ternary conditional (C?t:f ), in contrast to legacy LL984, is not available in Control Expert ST syntax.
The already existing SEL
function block provides
this functionality and has to be used instead.
Example:
Legacy syntax:
400010 := 300010 < 300020
? 300004 : 300005
Control Expert syntax:
%MW10 := SEL(%IW10 < %IW20, %IW4, %IW50);
With the following, automatically created by the editor:
_400010 := SEL(_300010 < _300020, _300004, _300005);
Bitwise Shift
Bitwise shift (<<, >>), in contrast to legacy LL984, is not available in Control Expert ST syntax.
The already
existing SHL
and SHR
function blocks
provide this functionality and have to be used instead.
Example:
Legacy syntax:
400010 = 300010U <<
3
Control Expert syntax:
%MW100W := SHL(%IW10W, 3);
With the following, automatically created by the editor:
_400100_W
:= SHL(_300010_W, 3);
Function Blocks
In general you can use the function blocks provided for ST language.
In particular the following Control Expert function blocks replace the legacy function blocks listed below.
Legacy Function Name |
Control Expert Function Name |
Argument Type* |
Return Type* |
Meaning |
---|---|---|---|---|
ABS |
ABS |
S,U,L,UL,F |
S,U,L,UL,F |
absolute value |
ARCCOS |
ACOS |
F |
F |
arc cosine |
ARCSIN |
ASIN |
F |
F |
arc sine |
ARCTAN |
ATAN |
F |
F |
arc tangent |
COS |
COS |
F |
F |
cosine |
COSD |
COSD |
F |
F |
cosine of degrees |
EXP |
EXP |
F |
F |
exponent function (power of e) (does not need to be a whole number) |
FIX |
REAL_TO |
F |
L |
convert floating point to integer (presumes an FP argument) |
FLOAT |
INT_TO |
S, U, L, UL |
F |
converts integer to floating point (presumes an integer argument) |
LN |
LN |
F |
F |
natural logarithm (base e) |
LOG |
LOG |
F |
F |
common logarithm (base 10) |
SIN |
SIN |
F |
F |
sine of radians |
SIND |
SIND |
F |
F |
sine of degrees |
SQRT |
SQRT |
F |
F |
square root |
TAN |
TAN |
F |
F |
tangent of radians |
TAND |
TAND |
F |
F |
tangent of degrees |
*: S=INT, U=UINT, L=DINT, UL=UDINT, F=REAL |
Example of an LL984 Expression
Legacy syntax:
40701 = 40702U + COS(40703UL)
* #8.00135F + SIN(40704);
Control Expert syntax:
%MW701 := REAL_TO_UINT(WORD_TO_REAL(%MW702W)
+ COS(WORD_AS_REAL(%MW703W, %MW704W)) * 8.00135 + SIN(WORD_TO_REAL(%MW704W)));
With the following, automatically created by the editor:
_400701 := REAL_TO_UINT(WORD_TO_REAL(_400702_W) + COS(WORD_AS_REAL(_400703_W,
_400704_W)) * 8.00135 + SIN(WORD_TO_REAL(_400704_W)));