EasyManuals Logo

Moog SmartMotor User Manual

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
Page #723 background imageLoading...
Page #723 background image
Part 2: Commands
Moog Animatics SmartMotor Developer's Guide,Rev. L
Page 723 of 909
EXAMPLE:
x=0 'Set variable x equal to zero
GOTO0 'Go directly to the C0 label
C10
PRINT(#13, "NO PROGRAM CRASH")
RETURN
END
'The following commands intentionally call subroutines without RETURN commands
C0 x=x+1 PRINT("x=",x,#13) GOSUB1 'First GOSUB without return.
C1 x=x+1 PRINT("x=",x,#13) GOSUB2 'Second GOSUB without return.
C2 x=x+1 PRINT("x=",x,#13) GOSUB3 'Third GOSUB without return.
C3 x=x+1 PRINT("x=",x,#13) GOSUB4 'Fourth GOSUB without return.
C4 x=x+1 PRINT("x=",x,#13) GOSUB5 'Fifth GOSUB without return.
C5 x=x+1 PRINT("x=",x,#13) GOSUB6 'Sixth GOSUB without return.
C6 x=x+1 PRINT("x=",x,#13) GOSUB7 'Seventh GOSUB without return.
C7 x=x+1 PRINT("x=",x,#13) GOSUB8 'Eighth GOSUB without return.
C8 x=x+1 PRINT("x=",x,#13) GOSUB9 'Ninth GOSUB without return.
C9 x=x+1 PRINT("x=",x,#13) 'GOSUB10 'if this GOSUB is called,
'the program WILL crash!
STACK 'Reset internal stack, which
GOSUB10 'allows this GOSUB to execute without crashing the program.
PRINT(#13,"RETURN FROM GOSUB10 OK",#13)
END
Program output is:
x=1
x=2
x=3
x=4
x=5
x=6
x=7
x=8
x=9
x=10
NO PROGRAM CRASH
RETURN FROM GOSUB10 OK
The previous example does not show the preferred way to write code. It is provided to show
where the STACK command would be used to prevent program crashes.
Often, the STACK command is used after an error or motor-protection fault is detected. Then,
immediately after the STACK command, a RUN, END or GOTO command (located near the top
of the program) is issued to recover.
Part 2: Commands: STACK

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the Moog SmartMotor and is the answer not in the manual?

Moog SmartMotor Specifications

General IconGeneral
BrandMoog
ModelSmartMotor
CategoryServo Drives
LanguageEnglish

Related product manuals