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 #183 background imageLoading...
Page #183 background image
Part 1: Programming
Moog Animatics SmartMotor Developer's Guide,Rev. L
Page 183 of 909
RUN
Execute Stored User Program
If the SmartMotor is reset with a Z command or at power-up, all previous variables and mode
changes are erased for a fresh start, and the program begins execution from the top.
Alternatively, the RUN command can be used to start the program, in which case the state of
the motor is unchanged and its program will be invoked.
RUN?
Halt Program If No RUN Issued
The RUN? command prevents further execution of code until the RUN command is received
over the serial channel. On power up, program code executes to the point of reaching the
RUN? command. When RUN is issued through the serial port, the CPU executes all code— it
starts at the top and moves down through the program, jumps over the RUN? command to the
next line of code and then continues execution to the end of the program.
PRINT("Boot-Up",#13) 'Message always prints
RUN? 'Pgm. stops here on reset or power up
PRINT("Run Issued",#13) 'This runs if RUN received
END
The above code prints the first message only after a Z command or on power-up, but it prints
both messages when a RUN command is received over the serial line.
During development, the RUN? command placed at the top of your program can protect you
from accidentally locking up your SmartMotor with a bad program.
GOTO#, GOTO(label), C#
Redirect Program Flow, Place a Label
The most basic command for redirecting program flow, without inherent conditions, is GOTO#
or GOTO(label), used in conjunction with the label C#. A label consists of the letter C followed
by a number (#) from 0 to 999, and it is inserted in the program as a placeholder. If a label
like C1 is placed in a program and that same number is placed at the end of a GOTO command
like GOTO1, the program flow will be redirected to label C1, and the program will proceed
from there.
C10 'Place label
IF IN(0)==0 'Check Input 0
GOSUB20 'If Input 0 low, call Subroutine 20
ENDIF 'End check Input 0
IF IN(1)==0 'Check Input 1
a=30 'as example for below
GOSUB(a) 'If Input 1 low, call Subroutine 30
ENDIF 'End check Input 1
GOTO(10) 'Will loop back to C10
As many as a thousand labels (0 - 999) can be used in a program. However, the program will
become increasingly difficult to read or debug as more GOTO commands are used.
Therefore, try using only one GOTO command, and use it to create the infinite loop necessary
to keep the program running indefinitely as some embedded programs do. For example, put a
Part 1: Programming: RUN

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