92
•
Chapter 7 Application Programming
DMC-1500
Using the JP Command:
The JP command will cause the controller to execute commands at the location specified by the label
or line number if the condition of the jump statement is satisfied. If no condition is specified, program
execution will automatically jump to the specified line. If the condition is not satisfied, the controller
will continue to execute the next commands in the program sequence.
Using the JS Command:
The JS command is significantly different from the JP command. When the condition specified by the
JS command is satisfied, the controller will begin execution at the program location specified by the
line or label number. However, when the controller reaches an end statement, EN, the controller will
jump back to the location of the JS command and resume executing the next commands. This is
known as jumping to a subroutine. For more information, see section
.
Each jump to a subroutine causes the controller to save the line number of the jump statement. This
information is saved in an area of program memory called the program stack. The program stack can
save up to 16 line numbers allowing a program to nest up to 16 jumps to subroutines. If it is necessary
to remove entries from the program stack, use the command ZS. For example, while executing a
subroutine, the program can be kept from jumping back to the original program line by issuing the
command ZS. This will remove all entries in the program stack and continue executing at the current
line. See section
and the Command Reference in Chapter 11.
Conditional Statements
The conditional statement is satisfied if it evaluates to any value other than zero. The conditional
statement can be any valid DMC-1500 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-1500 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 parenthesis for proper evaluation by the controller. In
addition, the DMC-1500 will execute operations from left to right. For further information on
Mathematical Expressions and the bit-wise operators ‘&’ and ‘|’, see pg. 7- 98.
For example, using variables named V1, V2, V3 and V4:
JP #TEST, (V1<V2) & (V3<V4)
Summary of Contents for DMC-1510
Page 6: ......
Page 18: ...6 Chapter 1 Overview DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...
Page 88: ...76 Chapter 6 Programming Motion DMC 1500 Figure 6 7 Motion intervals in the Home sequence...
Page 90: ...78 Chapter 6 Programming Motion DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...
Page 137: ...DMC 1500 Chapter 7 Application Programming 125 THIS PAGE LEFT BLANK INTENTIONALLY...
Page 157: ...DMC 1500 Chapter 10 Theory of Operation 145 THIS PAGE LEFT BLANK INTENTIONALLY...
Page 160: ...148 Appendices DMC 1500 Card Level Layout...
Page 180: ...168 Appendices DMC 1500...
Page 198: ...186 Appendices DMC 1500 THIS PAGE LEFT BLANK INTENTIONALLY...