STE 58762
- -
2-5
2.4 VARIABLES AND CONSTANTS
Not all data takes the same form, and these different forms of data are called data types. Scalar
type (integer type, real number type and character string) and vector type (position type, coordinate
type and load type) can be used in the SCOL language. Variables are divided into global variable
and auto variable according to the definition method. All taught data and variable defined in the
area between GLOBAL and END are called the global variable. These variables can be referred
and changed from any part of the program. For all data types of global variables, the array can be
declared. For descriptions of global variable and array, see Para. 2.8.5.
The work area in the controller is used for all data. The defined value is substituted for the global
variables value at the start of the program, except for the array without a specific initial. If the
value is entered for the variable during program execution, only the work area is changed. If the
power of controller is turned off, execution file is reselected or the file is edited, work area is reset by
the variable’s initial value saved in the file and the changed value is lost accordingly. This is also
applicable for change of the taught data. If the data in the file is to be overwritten, the RESTORE
command should be executed in the program.
2.4.1 Scalar Data
There are three types of scalar data, i.e., integers, real numbers and character strings. Scalar type
auto variables can only be used in the program in which they were declared. That means that if
you use a variable with the same name in another program, the two variables will be completely
independent and have nothing to do with each other. Therefore, when passing data from one
program to another, make it a point to, if possible, redefine the variable as the scalar type global
variable or declare the arguments in the program. (If you did not understand this too well, refer to
Section 2.8 "Programming.")
(1) Integer data
(a) Constants
SCOL can handle integer values ("whole numbers") in the range of - 2147483648 to + 2147483647.
When an integer is used as a constant in a program, if it is positive, directly describe the value; if it
is negative, describe the value following the - symbol. Examples are:
0
234
-39208
5963