Danfoss VLT 5000 Series Manual page 109

Synchronizing and positioning option onizing and positioning option
Hide thumbs Also See for VLT 5000 Series:
Table of Contents

Advertisement

I I I I I SUBMAINPROG .. ENDPROG
The code word SUBMAINPROG begins the sub-
routine 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; how-
ever, for reasons of clarity, it is advisable to insert it
either at the beginning or end of a program.
Summary
Subroutine section definition
Syntax
SUBMAINPROG
ENDPROG
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
MG.10.J4.02 – VLT is a registered Danfoss trade mark
®
VLT
5000 SyncPos option
I I I I I SUBPROG name .. RETURN
The instruction SUBPROG identifies the beginning
of a subroutine. The name of the subroutine 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 the 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.
Summary
Subroutine definition
Syntax
SUBPROG name
RETURN
Parameter
name = subroutine name
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 subroutine.
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
*/
*/
*/
109

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents