Conditional Jumps
The RIO provides Conditional Jump (JP) and Conditional Jump to Subroutine (JS) instructions for
branching to a new program location based on a specified condition. The conditional jump
determines if a condition is satisfied and then branches to a new location or subroutine. Unlike event
triggers such as the AI command, the conditional jump instruction does not halt the program
sequence. Conditional jumps are useful for testing events in real-time. They allow the RIO to make
decisions without a host computer.
Command Format - JP and JS
Format
Description
JS destination, logical condition
Jump to subroutine if logical condition is satisfied
JP destination, logical condition
Jump to location if logical condition is satisfied
The destination is a program line number or label where the program sequencer will jump if the
specified condition is satisfied. Note that the line number of the first line of program memory is 0.
The comma designates "IF". The logical condition tests two operands with logical operators.
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.
Chapter 5 Programming ▫ 62 RIO-47xxx Rev. 1.0r