STE 58762
- -
2-6
(b) Variables
Variables are distinguished by identifiers and can be in the range of - 2147483648 to +
~147483647, just as above. The data type of a variable is determined by the data type of the first
number you assign to that variable. For example, if the first thing you assign to a variable is an
integer, all other numbers substituted into that variable will become integers. That means that if
you later try to insert a real number into this variable, the controller will chop off all the decimal
places and treat what is left as an integer.
The variable comes in two types; the global variable which is valid in the entire program and the
general variable which is valid in a part of the program. The global variable can be changed from
any part of the program.
(c) Logical values
Logical values are used in the program when making conditional judgments. Logical expressions
and commands such as DIN (which check input signals) return logical values.
A logical value may have one of two values; TRUE or FALSE. Internally, logical values are treated
as integers with 1 being TRUE and 0 being FALSE.
Note)
(Strictly speaking, 0 is considered as FALSE and everything else is considered as TRUE.)
(2) Real data
With SCOL, numbers are treated as real types with the exception of certain special cases.
(a) Constants
SCOL can handle real numbers having an absolute value in the range of approximately 5.87 x 10
-3.9
to 6.80 x 10
38
. This range can also be expressed as 2
-127
to ((2
23
- 1) x 2
106
). The number
significant digits for the mantissa [the mantissa is the part of the number to the right of the decimal
point) is approximately 7 in Base 10. (The precision is 2
23
).
When a real number is used in the program, if it is positive, directly describe the value; if it is
negative, describe the value following the - symbol.
When the decimal part is 0, it is omissible. However, when the decimal point is omitted, the data
are treated as integer type data. In addition, since the integer part cannot be omitted, even if the
absolute value of a numeric value is less than 1, it is necessary to designate 0 to the integer part.