EasyManuals Logo

Mitsubishi Electric CR750-Q User Manual

Mitsubishi Electric CR750-Q
730 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #292 background imageLoading...
Page #292 background image
4-272 Detailed explanation of command words
4MELFA-BASIC V
On ... GoSub (ON Go Subroutine)
[Function]
Calls up the subroutine at the step label corresponding to the value.
[Format]
[Terminology]
<Terminology> Designate the step label on the step to branch to with a numeric operation expression.
<Call Destination> Describe the step label No. The maximum number is 32.
[Reference Program]
Sets the value equivalent to three bits of input signal 16 in M1, and branches according to the value of M1
(1 through 7).
(Calls label L1 if M1 is 1, label LSUB if M1 is 2, label L2 if M1 is 3, 4 or 5, and label L67 if M1 is 6 or 7.)
1 M1 = M_Inb(16) AND &H7
2 On M1 GoSub *L1,*LSUB,*L2,*L2,*L2,*L67,*L67
:
10 *L1
11 ' Describes processing when M1=1.
12 '
13 Return ' Be sure to return by using Return.
20 *LSUB
21 ' Describes processing when M1=2.
22 Return ' Be sure to return by using Return.
30 *L67
31 ' Describes processing when M1=6 or M1=7.
32 Return ' Be sure to return by using Return.
40 *L2
41 ' Describes processing when M1=3, M1=4, or M1=5.
42 '
43 Return ' Be sure to return by using Return.
[Explanation]
(1) The value of <Expression> determines which step label subroutine to call.
For example, if the value of <Expression> is 2, the step label described for the second value is called.
(2) If the value of <expression> is larger than the number of <destinations called up>, the program control
jumps to the next step. For example, the program control jumps to the next step if the value of <expres-
sion> is 5 and there are only three <destinations called up>.
(3) When a step No. or abel that is called up does not exist, or when there are two definitions, an error will
occur.
(4) Make sure to return from a subroutine using the Return command. An error occurs if the GoTo instruction
is used to return, because the free memory available for control structure (stack memory) decreases
and eventually becomes insufficient.
On[]<Terminology>[]GoSub[][<Expression>] [, [<Call Destination>]] ...
Value of <Expression> Process <Control>
Real number Value is converted to an integer by rounding it off,
and then branching is executed.
When 0, or when the value exceeds the num-
ber of step labels
Control proceeds to the next step
Negative number or 32767 is exceeded Execution error

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Mitsubishi Electric CR750-Q and is the answer not in the manual?

Mitsubishi Electric CR750-Q Specifications

General IconGeneral
ModelCR750-Q
ManufacturerMitsubishi Electric
Protection ClassIP20
Positioning ControlAbsolute
Communication InterfaceEthernet

Related product manuals