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 #121 background imageLoading...
Page #121 background image
4MELFA-BASIC V
MELFA-BASIC V functions 4-108
(4) Subroutine
Subroutine and subprograms can be used.
By using this function, the program can be shared to reduce the No. of steps, and the program can be cre-
ated in a hierarchical structure to make it easy to understand.
*Command word
*Statement example
*Related functions
Command word
Explanation
GoSub Calls the subroutine at the designated step or designated label.
On GoSub Calls the subroutine according to the designated variable number. The value conditions follow
the integer value order. (1,2,3,4,.......)
Return Returns to the step following the step called with the GoSub command.
CallP Calls the designated program. The next step in the source program is returned to at the End
statement in the called program. Data can be transferred to the called program as an argument.
FPrm An argument is transferred with the program called with the CallP command.
Statement example
Explanation
GoSub .......................................................
Calls the subroutine from step.
On GoSub...................................................
Calls the subroutine from label GET.
ON M1 GoSub *L1, *L2, *L3.......................
If the numeric variable M1 value is 1, calls the subroutine at step *L1, if 2 calls the subroutine at step
*L2, and if 3 calls the subroutine at step *L3. If the value does not correspond, proceeds to next step.
Return.........................................................
Returns to the step following the step called with the GoSub command.
CallP "10" ...................................................
Calls the No. 10 program.
CallP "20", M1, P1 ......................................
Transfers the numeric variable M1 and position variable P1 to the No. 20 program, and calls the
program.
FPrm M10, P10 ..........................................
Receives the numeric variable transferred with the CallP in M10 of the subprogram, and the position
variable in P10.
Function Explanation page
Interrupt........................................................................................
Page 107, "(3) Interrupt"
Communication ............................................................................
Page 112, "4.1.5 Communication"
Unconditional branching...............................................................
Page 104, "(1) Unconditional branching, conditional branching, waiting"

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