Download Print this page

Danfoss MCO 305 Design Manual page 152

Hide thumbs Also See for MCO 305:

Advertisement

MCO 305 Design Guide
SUBMAINPROG . . ENDPROG
Summary
Syntax
Description
Command Group
Cross Index
Syntax Example
Program Sample
SUBPROG name . . RETURN
Summary
Syntax
Parameter
Description
Command Group
Cross Index
Syntax Example
Program Sample
152
__ Software Reference __
Subroutine section definition
SUBMAINPROG
ENDPROG
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.
CON
SUBPROG .. RETURN, GOSUB, ON ERROR GOSUB, ON INT n GOSUB
SUBMAINPROG
subroutine 1
subroutine n
ENDPROG
GOSUB_01.M, AXEND_01.M, ERROR_01.M, INCL_01.M, STAT_01.M
Subroutine definition
SUBPROG name
RETURN
name = subroutine name
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.
CON
SUBMAINPROG .. ENDPROG, GOSUB, ON ERROR GOSUB, ON INT .. n GOSUB
SUBMAINPROG
SUBPROG sp1
command line 1
command line n
RETURN
ENDPROG
GOSUB_01.M, AXEND_01.M, ERROR_01.M, IF_01.M, STAT_01.M
®
MG.33.L4.02 – VLT
is a registered Danfoss trademark
/* Begin the subroutine section */
/* End the subroutine section */
/* begin SP-section */
/* begin sp1 */
/* end sp1 */
/* end SP-section */

Advertisement

loading