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 #246 background imageLoading...
Page #246 background image
Part 2: Commands
Moog Animatics SmartMotor Developer's Guide,Rev. L
Page 246 of 909
EXAMPLE:
ab[47]=20'Assign the value of 20 to ab[47]
Rab[47]'Report the value of ab[47] to the primary serial port
PRINT("ab[47]=",ab[47],#13)'Print to the primary serial port
PRINT1("ab[47]=",ab[47],#13)'Print to the secondary serial port
END
Program output is:
20
ab[47]=20
The ab[] array is classified as read/write, meaning that it can be assigned a value or can be
assigned to some other variable or function. In other words, these variables can be left-hand
or right-hand values.
EXAMPLE:
ab[24]=ab[43]+ab[7]
The above is a valid equation that combines the contents of ab[43] with ab[7] and sends the
total into ab[24]. As signed 8-bit variables, they are limited to whole numbers ranging from
-128 and 127. Math operations that result in digits after the decimal point are truncated
toward zero. Therefore, a value of 2.9 becomes 2, and a value of -2.9 becomes -2.
If you assign or perform an operation that would normally result in a value outside of this
range, the variable will "wrap" or take on the corresponding modulo. For example, 127+1=
-128; the result wrapped around to the negative extreme.
The following are other restrictions:
l
If ab[1]+a exceeds 32 signed bits, the operation c=ab[1]+a will abort and an error flag
is set.
l
If a-ab[1] exceeds 32 signed bits, the operation c=a-ab[1] will abort and an error flag is
set.
l
If a*ab[1] exceeds 32 signed bits, the operation c=a*ab[1] will abort and an error flag
is set.
The system flag, Bs, is set. Note that many different types of command errors will also
set the Bs bit. The RERRC command can be used to retrieve the last command error. For
a math overflow, that is error code 23. For details on the RERRC command, see ERRC on
page 441.
If one of these variables is used with a variable of another type, it will be appropriately
converted (the variable will be "type cast").
If the left-hand variable is an 8-bit one like ab[167], only the lowest 8 bits are preserved. The
sign is determined by bit 7 of the value on the right-side of the equals sign.
Conversely, if the left-hand value is a 32-bit variable and the right-hand side contains 8-bit
variables, the 8-bit variables will be "upgraded" to 32-bits. The sign is preserved when casting
to a longer format. In the equation cc=ab[4]-aw[7], both ab[4] and aw[7] are converted into
32-bit numbers before the subtraction occurs.
In the SmartMotor language, all user variables are written as lowercase letters, while
functions and commands have at least one uppercase character. The term "a" is a
general-purpose variable, while "A" is the acceleration function. As previously described, any
user variable can be assigned a value through an equation.
Part 2: Commands: ab[index]=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