Conditional jumps – Yaskawa SMC–4000 User Manual
Page 321
311
SMC–4000 User Manual
Conditional Jumps
The SMC–4000 provides Conditional Jump (JP) and Conditional Jump to Subroutine (JS) instructions
for branching to a new program location based on a specified condition. Unlike event triggers, the
conditional jump instruction does not halt the program sequence. Instead, it tests to see if a condition is
satisfied and then branches to a new location or subroutine. (A subroutine is a group of commands
defined by a label and EN command. After all the commands in the subroutine are executed, a return is
made to the main program). If the condition is not satisfied, the program sequence continues to the next
program line.
The JP and JS instructions have the following format:
The destination is a program line number or label. The destination is where the program sequencer jumps
to if the specified condition is satisfied. The comma designates "IF". The logical condition tests two
operands with logical operators. The operands can be any valid SMC–4000 numeric operand, including
variables, array elements, numeric values, functions, keywords, and arithmetic expressions.
Logical operators:
Operands:
The jump statement may also be used without a condition.
Format:
Meaning
JS destination, logical condition
Jump to subroutine if logical condition is satisfied
JP destination, logical condition
Jump to location if logical condition is satisfied
<
less than
>
greater than
=
equal to
<=
less than or equal to
>=
greater than or equal to
<>
not equal
Type
Examples
Number
V1=6
Numeric Expression
V1=V7*6
@ABS[V1]>10
Array Element
V1 Variable V1 Internal Variable _TPX=0 _TVX>500 I/O V1>@AN[2] @IN[1]=0