Danaher Motion
06/2005
BASIC Moves Development Studio
M-SS-005-03 Rev
E
13
The term,
Lvalue
, is a shorthand notation, which indicates the value to the
left of the equals sign. Valid
Lvalues
are variables or writable properties,
which can be assigned. Expressions can be variables, constants, properties
and function calls, as well as various combinations of them in arithmetic and
logical statements . An exception to this rule is generic elements’
assignment, at which the right side of the equal sign is not an expression, but
an axis or a group (either real or generic), and Lvalue is a generic elements.
If you assign a Double (floating point) value (expression, variable or
constant) to a Long variable, the fractional portion of the double value is
truncated, and the integer portion is assigned to the long variable. To query a
variable or expression from the BASIC Moves terminal window, use the
or
?
command:
PRINT 1/100
? X1
MC-BASIC also provides the standard
PRINTUSING
(
PrintU
) command for
formatted printing.
Commands for
flow control
change the way your program is executed.
Without flow control, program execution is limited to processing the line
immediately following the current command. Examples of flow control include
GOTO
,
FOR…NEXT
, and
IF…THEN
.
MC-BASIC is a multi-tasking language in which many tasks can run
concurrently. Generally, tasks run independently of each other. However,
tasks can control each other using
inter-task control
instructions. One task
can start, idle, or terminate another task.
Most commands are started and finished immediately. For example:
x = 1 ' this line is executed completely…
y = 2 ' …before this line is started
For general programming, one command is usually finished before the next
command starts. Effects of these commands do not persist beyond the time
required to execute them. However, the effects of many other commands
persist long after the execution of the command. In general programming, for
example, the effects of opening a file or allocating memory persist
indefinitely. In real-time systems,
persistence
is more complicated because
the duration of persistence is less predictable.
Consider a command that specifies a 1,000,000 counts move on an axis
named, A2:
Move A2 1000000.0
Y = 2
The MC does not wait for the 1,000,000 move to be complete before
executing Y=2. Instead, the first command starts the motion and then the MC
continues with the next line (Y = 2). The move continues well after the move
command has been executed.
Persistence can affect programs. For example, you may not want to start one
move until the previous move is complete. In general, you need access to
persistent processes if you are to control your program according to their
state of execution. As you will see later, MC-BASIC provides this access.