BASIC Moves Development Studio
06/2005
Danaher Motion
20 Rev
E
M-SS-005-03l
Despite the syntax, properties are not data elements, since a system
element and its properties are not located on a continuous block of memory.
All properties return a value, so they can be printed, combined in
expressions and passed by value to functions and subroutines. Many
properties are also writable and can be assigned like variables.
Unlike variables, properties do not have a fixed address in memory and
cannot be passed by reference. Data types of properties are Long, Double,
String, Joint and Location. For axis A1 and cam table Cam1, and a long type
variable named Var1:
? A1.Enable ‘
Query
A1.Enable = 1 ‘
Set (read-write property)
? A1.PositionCommand ‘
Query
A1.PositionCommand = 0 ‘
Syntax Error (read-only property)
Var1 = Cam1.Cycle ‘
Query
Cam1.Cycle = -1 ‘
Set (read-write property)
Var1 = Cam1.Inuse ‘
Query
Cam1.Inuse = 1 ‘
Syntax Error (read-only property)
2.2.6. Units
Many variables have associated units. This include variables, which contain
quantities of position, velocity, acceleration, and time. Some units are fixed.
For example, time is always in milliseconds. MC-BASIC allows you to define
units of position, velocity and acceleration independently. In the next chapter,
we will discuss how to set up units.
2.2.7. Expressions
Expressions are combinations of operators and value-returning entities, such
as variables, constants, function calls, which are all calculated into a value.
In MC-Basic, expressions can also contain unique entities like element
properties (see above) and system properties (see below). Operators (like +
and -) specify how to combine the variables and constants. Expressions are
used in almost all commands.
An expression has one of two
syntax
forms
[operand] [binary operator] [operand]
[unary operator] [operand]
An operand can be a constant (123.4), variable name (X), or another
expression. Most operators are binary (they take two operands), but some
are unary (taking only one operand). So, -5.5 is a valid expression. It has the
unary minus (also called negation) and a single operand.
There are two
types
of expressions: algebraic and logical (or Boolean).
Algebraic expressions
are combinations of data and algebraic operators.
The results of all algebraic operations are converted to double precision
floating-point after executing the expression.
2.2.8.
Automatic Conversion of Data Types
If the assignment of an expression is an integer, the expression is still
evaluated in double precision. For example:
Common Shared I as Long
I = 6.33 * 2.79