Logical operators:
Operator
Description
< less
than
> greater
than
= equal
to
<=
less than or equal to
>=
greater than or equal to
<> not
equal
Conditional Statements
The conditional statement is satisfied if it evaluates to any value other than zero. The conditional statement
can be any valid RIO numeric operand, including variables, array elements, numeric values, functions,
keywords, and arithmetic expressions. If no conditional statement is given, the jump will always occur.
Examples:
Number V1=6
Numeric Expression
V1=V7*6
@ABS[V1]>10
Array Element
V1<Count[2]
Variable V1<V2
Internal Variable
_TI1=255
_DM<100
I/O V1>@IN[2]
@IN[1]=0
Multiple Conditional Statements
The RIO will accept multiple conditions in a single jump statement. The conditional statements are
combined in pairs using the operands “&” and “|”. The “&” operand between any two conditions, requires
that both statements be true for the combined statement to be true. The “|” operand between any two
conditions requires that only one statement be true for the combined statement to be true.
Note: Each condition must be placed in parentheses for proper evaluation by the RIO. In addition, the RIO
executes operations from left to right.
For example, using variables named V1, V2, V3 and V4:
JP #TEST, (V1<V2) & (V3<V4)
In this example, this statement will cause the program to jump to the label #TEST if V1 is less than V2 and
V3 is less than V4. To illustrate this further, consider this same example with an additional condition:
JP #TEST, ((V1<V2) & (V3<V4)) | (V5<V6)
This statement will cause the program to jump to the label #TEST under two conditions: 1) If V1 is less than
V2 AND V3 is less than V4. OR 2) If V5 is less than V6.
Using the JP Command:
If the condition for the JP command is satisfied, the RIO branches to the specified label or line number and
continues executing commands from this point. If the condition is not satisfied, the RIO board continues to
execute the next commands in sequence.
Instruction
Interpretation
RIO-47xxx
Chapter 5 Programming
●
57
Содержание RIO-47**0
Страница 2: ......
Страница 93: ...RIO Dimensions RIO 471xx Units in centimeters RIO 47xxx Appendix 87...
Страница 94: ...RIO 472xx Units in millimeters 88 Appendix RIO 47xxx...
Страница 107: ...Internal 56 64 Zero Stack 53 RIO 47xxx Index 101...