EasyManua.ls Logo

Allen-Bradley Logix5000

Allen-Bradley Logix5000
708 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 675
Structured Text Programming Appendix C
The table shows some examples.
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.
Use these relational operators.
Use this format Example
For this situation Write
value1 operator value2 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’"
gain_4_adj := gain_4+15;
operator value1 If alarm and high_alarm are DINT tags and your
specification says: ‘Negate high_alarm and store the
result in alarm.’
alarm:= -high_alarm;
function(numeric_expression) 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.’
overtravel_POS := ABS(overtravel);
value1 operator (function((value2+value3)/2) 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.’
position := adjustment +
ABS((sensor1 + sensor2)/2);
If the comparison is The result is
True 1
False 0
For this comparison Use this operator Optimal data type
Equal = DINT, REAL, string
Less than < DINT, REAL, string
Less than or equal <= DINT, REAL, string
Greater than > DINT, REAL, string
Greater than or equal >= DINT, REAL, string
Not equal <> DINT, REAL, string

Table of Contents

Other manuals for Allen-Bradley Logix5000

Related product manuals