Conditional Jumps
The DMC-42x0 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, the conditional jump instruction
does not halt the program sequence. Conditional jumps are useful for testing events in real-time. They allow the
controller to make decisions without a host computer. For example, the DMC-42x0 can decide between two
motion profiles based on the state of an input line.
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 DMC-42x0 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
_TPX=0
_TVX>500
I/O
v1>@AN[2]
@IN[1]=0
Multiple Conditional Statements
The DMC-42x0 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 must 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 controller. In addition, the DMC-
42x0 executes operations from left to right. See
Mathematical and Functional Expressions
for more information.
For example, using variables named v1, v2, v3 and v4:
JP #TEST,((v1<v2)&(v3<v4))
Chapter 7 Application Programming ▫ 110
DMC-42x0 User Manual
Содержание DMC-42 0 Series
Страница 85: ...Chapter 6 Programming Motion 81 DMC 42x0 User Manual Figure 6 14 ECAM cycle with Z axis as master...
Страница 195: ...ICM 2900 PCB Layout Appendices 191 DMC 42x0 User Manual...
Страница 205: ...CB 50 100 Drawings Appendices 201 DMC 42x0 User Manual...
Страница 206: ...Appendices 202 DMC 42x0 User Manual...
Страница 207: ...Appendices 203 DMC 42x0 User Manual...
Страница 208: ...Appendices 204 DMC 42x0 User Manual...
Страница 209: ...Appendices 205 DMC 42x0 User Manual...
Страница 210: ...Appendices 206 DMC 42x0 User Manual...
Страница 211: ...Appendices 207 DMC 42x0 User Manual...
Страница 214: ...CB 50 80 Drawing Appendices 210 DMC 42x0 User Manual...
Страница 215: ...Appendices 211 DMC 42x0 User Manual...