EasyManua.ls Logo

Moog SmartMotor

Moog SmartMotor
909 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
Loading...
Part 2: Commands
Moog Animatics SmartMotor Developer's Guide,Rev. L
Page 464 of 909
l
GOSUB1 Traditional format (no parenthesis)
l
GOSUB(1) With parenthesis
l
GOSUB(a) Any variable may be used
The third format allows for highly flexible programs that can call an array of different
subroutines.
EXAMPLE:
GOSUB20 'Run subroutine 20
GOSUB21 'Run subroutine 21
a=3
GOSUB25 'Run subroutine 25
END 'End code execution
C20 'Nested subroutine
GOSUB30
PRINT("20",#13)
RETURN
C21 'Nested subroutine
GOSUB30
PRINT("21",#13)
RETURN
C25 'Recursive subroutine
PRINT(" 25:",a)
a=a-1
IF a==0
RETURN
ENDIF
GOSUB25
RETURN
C30 'Normal subroutine
PRINT(#13,"Subroutine Call ")
RETURN
Program output is:
Subroutine Call 20
Subroutine Call 21
25:3 25:2 25:1
Referring to the previous example, the GOSUB commands: GOSUB20, GOSUB21, GOSUB25 or
GOSUB30 can also be issued from the terminal.
RELATED COMMANDS:
C{number} Command Label (see page 348)
GOTO(label) Branch Program Flow to a Label (see page 465)
STACK Stack Pointer Register, Clear (see page 722)
Part 2: Commands: GOSUB(label)

Table of Contents

Related product manuals