Rockwell-automation 1746-BAS BASIC LANGUAGE User Manual Page 29

  • Download
  • Add to my manuals
  • Print
  • Page
    / 280
  • Table of contents
  • BOOKMARKS
  • Rated. / 5. Based on customer reviews
Page view 28
Publication 1746-RM001A-US-P
Expressions and Operators 3-7
Relational Operators
Relational expressions involve the operators =, < >, >, >=, <, and <=. In the module,
relational operations are typically used to test a condition. The module relational
operators return a result of 65535 (0FFFFH) if the relational expression is true, and
a result of 0 if the relation expression is false. The result returns to the argument
stack. Because of this, it is possible to display the result of a relational expression.
Relational expressions are shown as:
[rel expr]
You can chain relational expressions with the logical operators .AND., .OR., and
.XOR.. This makes it possible to test a complex condition with ONE statement.
>10 IF (A>E).AND.(A>C).OR.(A>D)THEN...
Additionally, you can use the NOT([expr]) operator.
>10 IF NOT(A>E).AND.(A>C)THEN...
By chaining relational expressions with logical operators, you can test particular
conditions with one statement.
Example Result
>PRINT 1=0 0
>PRINT 1>0 65535
>PRINT A<>A 0
>PRINT A=A 65535
IMPORTANT
When using logical operators to link relational expressions, you
must be sure operations are performed in the proper sequence.
When in doubt, use parentheses.
Page view 28
1 2 ... 24 25 26 27 28 29 30 31 32 33 34 ... 279 280

Comments to this Manuals

No comments