Omron TJ2-MC64 - PROGRAMMING Programming Manual page 164

Hide thumbs Also See for TJ2-MC64 - PROGRAMMING:
Table of Contents

Advertisement

BASIC commands
Description
The ON..GOSUB and ON..GOTO structures enable a conditional jump. The
integer expression is used to select a label from the list. If the expression has
value 1 the first label is used, for value 2 the second label is used, and so on.
Once the label is selected, subroutine GOSUB jump to that label is per-
formed.
Note: If the expression is not valid e.g. the result of the expression is less than
1 or greater that the number of available labels in the program, no jump is
performed.
Arguments
expression
Any valid BASIC expression.
label
Any valid label in the program.
Example
REPEAT
GET#5,char
UNTIL 1<=char and char<=3
ON char GOSUB mover, stopper, change
See also
GOSUB..RETURN, GOTO.
3.2.217 ON.. GOTO
/i
Type
Program control command
Syntax
ON expression GOTO label [,label[,...]]
Description
The expression is evaluated and then the integer part is used to select a label
from the list. If the expression has the value 1 then the first label is used, 2
then the second label is used, and so on. If the value of the expression is less
than 1 or greater than the number of labels then an error occurs. Once the
label is selected, subroutine GOTO jump to that label is performed.
Arguments
expression
Any valid BASIC expression.
label
Any valid label in the program.
Example
REPEAT
GET #1,char
UNTIL 1<=char and char<=3
ON char GOTO mover,stopper,change
PROGRAMMING MANUAL
See also
N/A
3.2.218 OP
/i
Type
I/O command
Syntax
OP(output_number, value)
OP(binary_pattern)
OP
Description
The OP command sets one or more outputs or returns the state of the first 24
outputs. OP has three different forms depending on the number of argu-
ments.
Command OP(output_number,value) sets a single output channel. The
range of output_number depends on the number of additional digital I/O
connected over the MECHATROLINK-II bus and value is the value to be
output, either 0 or 1.
Command OP(binary_pattern) sets the binary pattern to the 24 outputs
according to the value set by binary_pattern.
Function OP (without arguments) returns the status of the first 24 out-
puts. This allows multiple outputs to be set without corrupting others
which are not to be changed.
Note: The first 8 outputs (0 to 7) do not physically exist on the TJ2-MC64.
They can not be written to and will always return 0.
Arguments
output_number
The number of the output to be set. The range for this parameter
depends on the number of additional digital I/O connected over the
MECHATROLINK-II bus. If there are no digital I/O connected, the range
for this parameter is 8..31
value
The value to be output, either OFF (0) or ON (1). All non-0 values are
considered as ON.
binary_pattern
The integer equivalent of the binary pattern is to be output.
Example
OP(12,1)
OP(12,ON)
These two lines are equivalent.
158

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Tj1-prtTj1-drtTj1-cortTj1-mlGrt1-ml2Tj1-fl02

Table of Contents