Data Structures And Variables - Omron R88A-MCW151-DRT-E Operation Manual

Mcw151 series motion control option board
Table of Contents

Advertisement

BASIC Programming
Task Statements
System Statements
5-2-2

Data Structures and Variables

Table Variables
Global Variables
Precautions for using
Table and VR variables
Local Variables
Labels
in the axis dependent command. A temporary base axis is effective only for
the command or parameter after which AXIS appears.
The task parameters apply to a single task. The task parameters monitor the
task for example for error handling. The PROC modifier allows the user to
access a parameter of a certain task. Without PROC the current task is
assumed. The BASE command (see above) is task specific and can be used
with the PROC modifier.
These statements govern the overall system features, which are basically all
statements which do not belong to the first two groups.
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 MC Unit's Table, global and local variables are
explained in this section. Furthermore also the use of labels will be specified.
The Table is an array structure that contains a series of numbers. These num-
bers 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 MC Unit, i.e., 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 maxi-
mum length of the array is 8000 elements, from TABLE(0) to TABLE(7999).
The Table array is initialized up to the highest defined element.
The global variables, also called VR variables, are common to all tasks on the
MC Unit. This means that if a program running on task 2 sets VR(25) to a cer-
tain 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 251 global variables,
VR(0) to VR(250). The variables are read and written using the VR command.
1. The Table and VR data can be accessed from the different running tasks.
When using either VR or Table variables, be sure to use only one task to
write to one particular variable. This to avoid problems of two program
tasks writing unexpectedly to one variable.
2. The Table and VR data in RAM are not backed up and will be lost when
the power of the MC Unit is switched OFF. If valid data needs to be recov-
ered during start-up, write the data into Flash memory using the FLASHVR
command.
Named variables or local variables can be declared in programs and are local
to the task. This means that two or more programs running on different tasks
can use the same variable name, but their values can be different. Local vari-
ables cannot be read from any task except for the one in which they are
declared. Local variables are always cleared when a program is started. The
local variables can be cleared by using either the CLEAR or the RESET com-
mand.
A maximum of 255 local variables can be declared. Only the first 16 charac-
ters of the name are significant. Undefined local variables will return zero.
Local variables cannot be declared on the command line.
The BASIC programs are executed in descending order through the lines.
Labels can be used to alter this execution flow using the BASIC commands
Section 5-2
87

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

R88a-mcw151-e

Table of Contents