Use this format
value1 operator value2
operator value1
function(numeric_expression)
value1 operator (function((value2+value3)/2)
The table shows some examples.
Example
For this situation
If gain_4 and gain_4_adj are DINT tags and your
specification says: 'Add 15 to gain_4 and store the result
in gain_4_adj'"
If alarm and high_alarm are DINT tags and your
specification says: 'Negate high_alarm and store the
result in alarm.'
If overtravel and overtravel_POS are DINT tags and your
specification says: 'Calculate the absolute value of
overtravel and store the result in overtravel_POS.'
If adjustment and position are DINT tags and sensor1 and
sensor2 are REAL tags and your specification says: 'Find
the absolute value of the average of sensor1 and sensor2,
add the adjustment, and store the result in position.'
Use Relational Operators
Relational operators compare two values or strings to provide a true or false
result. The result of a relational operation is a BOOL value.
If the comparison is
True
False
Use these relational operators.
For this comparison
Equal
Less than
Less than or equal
Greater than
Greater than or equal
Not equal
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
Structured Text Programming
Write
gain_4_adj := gain_4+15;
alarm:= -high_alarm;
overtravel_POS := ABS(overtravel);
position := adjustment +
ABS((sensor1 + sensor2)/2);
The result is
1
0
Use this operator
Optimal data type
=
DINT, REAL, string
<
DINT, REAL, string
<=
DINT, REAL, string
>
DINT, REAL, string
>=
DINT, REAL, string
<>
DINT, REAL, string
Appendix C
675