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 #728 background imageLoading...
Page #728 background image
Part 2: Commands
Moog Animatics SmartMotor Developer's Guide,Rev. L
Page 728 of 909
Each SWITCH control block must have at least one CASE number defined plus one, and only
one, ENDS statement. SWITCH is not a valid terminal command it is only valid within a user
program.
EXAMPLE:
Consider the following code fragment:
SWITCH v
CASE 1
PRINT(" v = 1 ",#13)
BREAK
CASE 2
PRINT(" v = 2 ",#13)
BREAK
CASE 3
PRINT(" v = -23 ",#13)
BREAK
DEFAULT
PRINT("v IS NOT 1, 2 OR -23",#13)
BREAK
ENDS
The first line, SWITCH v, lets the SmartMotor™ know that it is checking the value of the
variable v. Each following CASE begins the section of code that tells the SmartMotor what to
do if v is equal to that case.
EXAMPLE:
a=-3 'Assign a value
WHILE a<4
PRINT(#13,"a=",a," ")
SWITCH a 'Test the value
CASE 3
PRINT("MAX VALUE",#13)
BREAK
CASE -1 'Negative test values are valid
CASE -2 'Note no BREAK here
CASE -3
PRINT("NEGATIVE")
BREAK 'Note use of BREAK
CASE 0 'Zero test value is valid
PRINT("ZERO") 'Note order is random
DEFAULT 'The default case
PRINT("NO MATCH VALUE")
BREAK
ENDS 'Need not be numerical
a=a+1
LOOP
END
Part 2: Commands: SWITCH formula

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