Exploring logical expressions
For a control statement to work, it will need some type of logical expression to evaluate to True
for the code in the statement to be executed. A logical expression can be thought of as something akin to comparing two numbers to see if they are equal, if one number is less than the other, or if one number is greater than the other. The IEC 61131-3 standard uses the following for logical comparisons:
- Equal: The equals operator compares two values and will evaluate to
True
if the two numbers are equal. In IEC 61131-3, the equals operator is denoted with the=
symbol. - Not equal: The not equals operator is the inverse of the equals operator. In short, when the two values in the expression are not the same, the expression will return
True
. Not equal is denoted by the<>
symbol in IEC 61131-3. - Less than: The less-than operator will check if one number is less than the other. If the number on the left is less than the number on the right...