Example using variables named v1, v2, v3 and v4, Jp #test, (v1 Page 302: Examples
Page 302: Examples

292
LEGEND-MC User’s Manual
NOTE: Each condition must be placed in parentheses for proper evaluation by the controller. In addition,
the LEGEND-MC executes operations from left to right.
Example using variables named V1, V2, V3 and V4:
JP #TEST, (V1 In this example, this statement will cause the program to jump to the label #TEST if V1 is less than V2 JP #TEST, ((V1 This statement will cause the program to jump to the label #TEST under two conditions; 1. If V1 is less Examples If the condition for the JP command is satisfied, the controller branches to the specified label or line Format Meaning JP #Loop, COUNT<10 Jump to #Loop if the variable, COUNT, is less than 10 JS #MOVE2,@IN[1]=1 Jump to subroutine #MOVE2 if input 1 is JP #BLUE,@ABS[V2]>2 Jump to #BLUE if the absolute value of JP #C,V1*V7<=V8*V2 Jump to #C if the value of V1 times V7 is less than or equal value of V8*V2 JP#A Jump to #A
and V3 is less than V4. To illustrate this further, consider this same example with an additional condition:
than V2 and V3 is less than V4. OR 2. If V5 is less than V6.
number and continues executing commands from this point. If the condition is not satisfied, the controller
continues to execute the next commands in sequence.
logic level high. After thesubroutine MOVE2
is executed, the program sequencer returns to
the main program location where the
subroutine was called.
variable, V2, is greater than 2
to the