EasyManuals Logo

Mitsubishi MELFA CR1D User Manual

Mitsubishi MELFA CR1D
458 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 #245 background imageLoading...
Page #245 background image
4MELFA-BASIC IV
Detailed explanation of command words 4-232
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 line 1000 if M1 is 1, label LSUB if M1 is 2, line 2000 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 instruction. An error occurs if the GoTo instruc-
tion 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 MELFA CR1D and is the answer not in the manual?

Mitsubishi MELFA CR1D Specifications

General IconGeneral
BrandMitsubishi
ModelMELFA CR1D
CategoryController
LanguageEnglish

Related product manuals