Intel 9800758-02 Webcam User Manual


 
BASIC-SO
Language Elements
Converting Data
It
is
sometimes useful to convert one type
of
data into another.
BASIC-SO
suppo. I...,
these conversions with the HEX$, OCT$, CHR$, STR$, VAL, CVD, CVI, CVS,
CDBL, CSNG, CINT, MKS$, MKD$, and MKI$ functions.
The HEX$ and
OCT$ functions return a string
of
hexadecimal and octal digits,
respectively, that represent the numeric argument. The
STR$ function returns a
string
of
decimal digits that represent the decimal value of the argument. The VAL
function returns the numeric value
of
the string argument, if the string
is
a number.
CHR$ returns the
ASCII equivalent
of
an integer argument, between 0 and 255.
The CVI,
CVS, and CVD functions convert a given string into integer, single- preci-
sion floating-point,
or
double-precision floating-point numeric values, respectively.
These functions are used to retrieve numeric values from the
input/
output buffer
when doing random disk
110.
The MKI$, MKS$, and MKD$ functions convert integer, single-precision floating-
point, and double-precision floating-point numeric values, respectively, into a
string. These functions are used to store humeric values in the input/output buffer
when doing random disk
110.
You can convert a numeric variable (integer, single-precision floating-point,
or
double-precision floating-point) to any
of
these types by using the variable in an
ex-
pression with the CINT, CDBL, or CSNG functions:
A# =
CDSl
(A%)
l4!
= CSNG
(l4)
VAR5 = CINT (VAR5)
Array Variables
An array
is
a group
of
variables identified by the same name, specified by subscripts
that define their position in the array. An array variable can have as many dimen-
sions as will fit on a single line. An array variable
is
specified by following a variable
name with as many subscripts as there are dimensions. A subscript must be an in-
teger value, and enclosed within parentheses
or
square brackets.
If
there
is
more
than one subscript, separate them with a comma. Expressions can be used to specify
subscripts; they are rounded to integer form. Here are some array variables:
X
(10)
R1
(5,4)
Y(I,1)
SA(I + 3,X(10))
BASIC-SO
normally indexes arrays from zero; that is; the first element in
an
array
is
defined as
O.
To start arrays
at
one in BASIC-SO, enter the instruction OPTION
BASE
1 in your program before you dimension or reference any arrays.
The DIM statement allocates array space and specifies the maximum allowable
subscript for a given dimension.
If
an array variable
is
referenced before it has been
formally dimensioned,
BASIC-SO
allocates
an
index
of
10
for each dimension. Some
examples
of
the DIM statement:
DIM X(15)
DIM R1(12,8)
DIM K(17,24)
An attempt
to
specify
an
array variable whose subscripts are larger than the dimen-
sioned value, or which exceed
10
in the default mode, causes a SUBSCRIPT OUT
OF
RANGE error
message~
2-9