
MCO 305 Design Guide
__ Software Reference __
152
MG.33.L4.02 – VLT
®
is a registered Danfoss trademark
SUBMAINPROG . . ENDPROG
Summary
Subroutine section definition
Syntax
SUBMAINPROG
ENDPROG
Description
The code word SUBMAINPROG begins the subroutine section, and the code word
ENDPROG ends this specific program. The term subroutine means command
sequences that, via the GOSUB instructions, can be called up and executed from
various program positions.
All necessary subroutines must be contained within the subroutine section. It is
possible to insert a subroutine anywhere within a main program; however, for rea-
sons of clarity, it is advisable to insert it either at the beginning or end of a program.
NB!:
Only one subroutine area may be inserted within a program.
Command Group
CON
Cross Index
SUBPROG .. RETURN, GOSUB, ON ERROR GOSUB, ON INT n GOSUB
Syntax Example
SUBMAINPROG
/* Begin the subroutine section */
subroutine
1
subroutine
n
ENDPROG
/* End the subroutine section */
Program Sample
GOSUB_01.M, AXEND_01.M, ERROR_01.M, INCL_01.M, STAT_01.M
SUBPROG name . . RETURN
Summary
Subroutine definition
Syntax
SUBPROG name
RETURN
Parameter
name = subroutine name
Description
The instruction SUBPROG identifies the beginning of a subroutine. The name of the sub-
routine must directly follow SUBPROG code word. The name can be made up of one or
more characters, and must be unique, i.e. only one subroutine may have that name.
A subroutine can be called up and executed at any time by use of a GOSUB instruction.
A subroutine can have any number of command lines and can refer to all program
variables. The last command in each subroutine must be the RETURN instruction,
which permits exiting the subroutine and continuing the program with the
command following the GOSUB instruction.
NB!:
All subroutines must be contained within the SUBMAINPROG and ENDPROG defined
areas. It is not admissible to declare a second subroutine within an existing sub-
routine.
Command Group
CON
Cross Index
SUBMAINPROG .. ENDPROG, GOSUB, ON ERROR GOSUB, ON INT .. n GOSUB
Syntax Example
SUBMAINPROG
/* begin SP-section */
SUBPROG sp1
/* begin sp1 */
command line 1
command line n
RETURN
/* end sp1 */
ENDPROG
/* end SP-section */
Program Sample
GOSUB_01.M, AXEND_01.M, ERROR_01.M, IF_01.M, STAT_01.M
Summary of Contents for MCO 305
Page 4: ......