Trajexia system
PROGRAMMING MANUAL
10
R
e
vi
si
o
n
1
.0
VR memory
VR memory is commonly used if some data or value needs to be global,
which means that it is accessible from all programs in the project at the
same time. The size of this memory is 64,000 slots with indexes 0 to 63,999.
A memory slot is addressed using the
VR(x)
macro where
x
is index of the
VR memory slot. The VR memory is accessible for reading and writing.
Writing is done by making mathematical assignment using the
=
command
in the program. The content of this memory is held in the battery powered
RAM memory and is preserved during power off. The VR memory is also
preserved when changing the battery, if this is done quickly.
TABLE memory
TABLE is commonly used if some data or value needs to be global, which
means that it is accessible from all programs in the project at the same time.
Whereas the VR memory is used for similar purposes to define several
global data and values, TABLE memory is used for much bigger amounts of
global data, which also need to be arranged in a certain order. For this
reason, TABLE memory is commonly used for storing TABLE data, motion
profiles, logging data, etc. Some BASIC commands that provide this type
and size of data, for example
SCOPE
,
CAM
,
CAMBOX
etc., require use of
TABLE memory to write their results. The size of this memory is 500,000
slots with indexes 0 to 499,999. The TABLE is accessible for reading and
writing too, but the way it is accessed differs for those two operations. Before
being read, a particular TABLE memory slot needs to be defined and written
first, using the command
TABLE(x, value1, value2,…)
where
x
is the index
of the start TABLE memory slot to define, and
value1
,
value2
, ... are the
values written into the TABLE memory at indexes x, x+1, ... Once defined
and written, the TABLE memory slot can be read using the
TABLE(x)
command, where
x
is the index of the TABLE memory slot. An attempt to
read an undefined TABLE memory slot results in an error reported by the
TJ2-MC64. The first 65,536 TABLE memory entries are held in the battery
powered RAM memory and is preserved during power off. This part of the
TABLE memory is also preserved when changing the battery, if this is done
quickly.
2.3.3
Data structures and variables
BASIC programs can store numerical data in various types of variables.
Some variables have predefined functions, such as the axis parameters and
system parameters; other variables are available for the programmer to
define as required in programming. The TABLE, global and local variables of
the TJ2-MC64 are explained in this section. Furthermore also the use of
labels will be specified.
TABLE variables
The TABLE is an array structure that contains a series of numbers. These
numbers are used for instance to specify positions in the profile for a
CAM
or
CAMBOX
command. They can also be used to store data for later use, for
example to store the parameters used to define a workpiece to be
processed.
The TABLE is common to all tasks on the TJ2-MC64. This means that the
values written to the TABLE from one task can be read from other tasks.
TABLE values can be written and read using the
TABLE
command. The
maximum length of the array is 500,000 elements, from
TABLE(0)
to
TABLE(499999)
. The TABLE array is initialized up to the highest defined
element.
Global variables
The global variables, defined in VR memory, are common to all tasks on the
TJ2-MC64. This means that if a program running on task 2 sets VR(25) to a
certain value, then any other program running on a different task can read
that same value from VR(25). This is very useful for synchronizing two or
more tasks, but care must be taken to avoid more than one program writing
to the same variable at the same time. The controller has 64,000 global
variables, VR(0) to VR(63999). The variables are read and written using the
VR
command.