JSJump to Subroutine Programming
_JS
The JS command allows the program to jump to a subroutine and eventually return to the line that called the command
JSOnly valid from within embedded code. No terminal.

Full Description

The JS command allows the program to jump to a subroutine and eventually return to the line that called the command.

The JS command will change the sequential order of execution of commands in a program. If the jump is taken, program execution will continue at the line specified by the destination parameter, which can be either a line number or label. The line number of the JS command is saved and after the next EN command is encountered (End of subroutine), program execution will continue with the instruction following the JS command. There can be a JS command within a subroutine, up to 16 deep.

Multiple conditions can be used 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.

A jump is taken if the specified condition is true. Each condition must be placed in parenthesis for proper evaluation by the controller.

ConditionValid
JS#A,(var1=0)&(var2=1)This conditional statement is valid
JS#A,var1=0&var2=1This conditional statement is not valid

Arguments

JS #label,condition

JS n,condition

where
#label is a defined label in the program that represents the line to jump to if condition is true
n is an integer or variable that defined the line to jump to if condition is true

condition is an optional conditional statement using a logical operator. If condition is left blank, then the JS command automatically evaluates as true.

The logical operators are:
     < less than or equal to
     > greater than
     = equal to
     <= less than or equal to
     >= greater than or equal to
     <> not equal

Operands

Usage

Usage and Default Details
UsageValue
While Moving (No RIO)Yes
In a ProgramYes
Command LineNo
Controller UsageAll

Examples

JS #SQUARE,(V1<5);' Jump to subroutine #SQUARE if V1 is less than 5
JS #LOOP,(V1<>0);'  Jump to #LOOP if V1 is not equal to 0
JS #A;'             Jump to subroutine #A (unconditionally)