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 #273 background imageLoading...
Page #273 background image
Part 2: Commands
Moog Animatics SmartMotor Developer's Guide,Rev. L
Page 273 of 909
EXAMPLE:
al[47]=20'Assign the value of 20 to al[47]
Ral[47]'Report the value of al[47] to the primary serial port.
PRINT("al[47]=",al[47],#13)'Print to the primary serial port.
PRINT1("al[47]=",al[47],#13)'Print to the secondary serial port.
END
Program output is:
20
al[47]=20
The al[] array is classified as read/write, meaning that it can be assigned a value, or it can be
assigned to some other variable or function. In other words, these variables can be left- or
right-hand values.
EXAMPLE:
al[24]=al[43]+al[7]
The above is a valid equation, combining the contents of al[43] and al[7] and sending the total
into al[24].
These variables are 32-bit signed integers, so they are limited to whole numbers from
-2147483648 to 2147483647. Math operations that result in digits after the decimal point are
truncated toward zero. Therefore, the value 2.9 becomes 2, and the value -2.9 becomes -2.
If you assign or perform an operation that normally results in a value outside this range, the
Bs bit indicates an overflow and the operation aborts before assigning the value to the left of
the equal sign.
The following are other restrictions:
l
If al[1]+a exceeds 32 signed bits, the operation c=al[1]+a aborts and an error flag is
set.
l
If a-al[1] exceeds 32 signed bits, the operation c=a-al[1] aborts and an error flag is set.
l
If a*al[1] exceeds 32 signed bits, the operation c=a*al[1] aborts 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").
For example, assigning the variable aw[27]=al[0] directly stores the 16 least-significant bits
of al[0] to aw[27]. The sign bit of al[0] is not considered, the sign is determined based on bit
15 of al[0]. The higher bits of the variable al[0] are ignored.
Conversely, if the left-hand value is a 32-bit variable and the right-hand side contains 16-bit
variables, the 16-bit variables will be "upgraded" to 32-bits. The sign is preserved when
casting to a longer format. In the equation al[0]=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
Part 2: Commands: al[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