Danaher Motion
06/2005
BASIC Moves Development Studio
Besides these basic types, MC-BASIC also supports Structure-like variables
and some MC-BASIC specific types, such as points (Joints and Locations),
generic motion elements (Axes and Groups) and UEAs (user error
assertions-Errors and Notes).
DeleteVar
deletes a global variable. Since variable name can include
wildcards, a single
DELETEVAR
can be used to delete more than one
variable.
DeleteVar int1
DeleteVar int* ' Deletes all variables starting with int
Current values of global variables (both scalar and arrays) can be stored in a
Prg file, in assignment format, within an automatically executable
Program
Continue…Terminate Program
block. Obligatory parameters of
SAVE
are
the name of storage file, and type of stored variables (could be all types).
Optional parameters are robot type (for point variables), variable name
(which may include wildcards) and mode of writing to storage file (overwriting
or appending). Variable types available for storage through
SAVE
are longs,
doubles, strings, joints and locations, but not structures, user-defined
exceptions nor generic motion elements.
Save File = “IntFile.Prg” Type = All VariableName = “int*”
‘ Save all variables starting with int in IntFile.Prg (overwrite file)
Save File = “Points.Prg” Type = Joint RobotType = XYZR Mode = Append
‘ Append all joint-type points with XYZR robot-type to Points.Prg file
Scope
defines how widely a variable can be accessed. The broadest scope
is global. A global variable can be read from any part of the system software.
Other scopes are more restrictive, limiting access of variables to certain
sections of code. MC-BASIC supports three scopes: global, task, and local.
Task variables can be read from or written to anywhere within the task where
it is defined, but not from outside the task. Local variables can only be used
within their declaration block, i.e. program, subroutine or function blocks. The
scope of a variable is implicitly defined when a variable is declared using the
keywords: Common, Shared, and Dim.
Global variables
can be defined within the system configuration task,
Config.Prg, within a task files (Prg files), before the program block, within
library files (Lib files), before the first subroutine or function block, or from the
terminal window of BASIC Moves. To declare a variable of global scope use
the Common Shared instruction.
Task variables
are defined within a task or a library. To declare a variable of
task scope use the Dim Shared instruction.
NOTE
All Dim Shared commands must appear above the Program
statement in task files. In library files, all Dim Shared commands
must appear above the first block of subroutine or function. The
values of variables declared with Dim Shared persist as long as the
task is loaded, which is usually the entire time the unit is
operational. This is commonly referred to as being static.
Local variables
are defined and used within a program, a subroutine, or a
function. To declare a local variable, use the Dim instruction. The Dim
command for local variables must be entered immediately below the
Program, Sub, or Function statement. Local variables cannot be declared
within event blocks, and events cannot use local variables declared within
the program.
M-SS-005-03 Rev
E
15