Omron SYSMAC C200H-ASC02 Operation Manual page 32

Ascii unit
Hide thumbs Also See for SYSMAC C200H-ASC02:
Table of Contents

Advertisement

Program Configuration
Variable Array
Type Conversion
1, 2, 3... 1.
22
Integer: Uses 2 bytes per variable.
! Single-precision real: Uses 4 bytes per variable.
# Double-precision real: Uses 8 bytes per variable.
$ Character: Uses a maximum of 255 characters.
There is a second way to declare variable types. The BASIC statements DE-
FINT, DEFSTR, DEFSNG, and DEFDBL may be used to declare the types
for certain variable names.
An array is a group of values of the same TYPE that is stored and referenced
as a unit by the same variable name. Each element in an array has a unique
position and is referenced by the name of the array subscripted with an inte-
ger or integer expression.
There can be many dimensions to an array. The most common types are
one, two, and three dimensional arrays. An array has one subscript for each
dimension in the array.
For example, T(4) would reference the fourth element in the one-dimensional
array T. R(2,3) would reference the value located in the second row and third
column of the two-dimensional array R.
The maximum number of dimensions of an array is 255. The maximum num-
ber of elements per dimension is 32767. The array size and number of di-
mensions must be declared with the DIM statement. The subscript value zero
is the position of the first element in an array. All elements of an array must
be of the same TYPE.
When necessary, BASIC will convert a numeric constant from one TYPE to
another. The following rules and examples apply:
If the numeric data on the right side of an assignment statement differs
from the type of data on the left side, the right side is converted to match
the left. However, character data cannot be converted to numerical data,
or vice versa.
Example:
A = 12.3:
2.
Double-precision data is converted to single-precision data when as-
signed to a single-precision variable.
Example:
IF "A" is a single-precision variable and the statement:
LET A = 12.3456789# occurs in a program, then 12.3456789# will be
converted to a single-precision number and then assigned to "A."
3.
When an arithmetic operation is performed using both single-precision
and double-precision values, the single-precision value is converted to
double-precision first, and then the operation is performed. Therefore,
the result is a double-precision value.
Example:
10#/3 (double-precision)
4.
In logic operations, all numeric data is first converted into integer data. If
any value cannot be converted into an integer within the range of
-32768 to 32767, an error will occur.
Example:
LET A = NOT 12.34, -13 is assigned as A.
5.
When a real number is converted into an integer, everything to the right
of the decimal point is rounded off.
if A is an integer, then "12" is assigned to A.
Section 4-1

Hide quick links:

Advertisement

Table of Contents
loading

Table of Contents