Specifications

Section 9. CR1000 Programming
9-7
9.6.1.2 Dimensions
Occasionally, a multi-dimensioned array is required by an application.
Dimensioned arrays can be thought of just as distance, area, and volume
measurements are thought of. A single dimensioned array, declared as
VariableName(x), can be thought of as x number of variables is a series. A
two-dimensional array, declared as:
Public (or Dim) VariableName(x,y),
can be thought of as (x) * (y) number of variables in a square x-by-y matrix.
Three-dimensional arrays (VariableName (x,y,z)) have (x) * (y) * (z) number
of variables in a cubic x-by-y-by-z matrix. Dimensions greater than three are
not permitted by CRBASIC.
Strings can be declared at a maximum of two dimensions. The third dimension
is used internally for accessing characters within a string.
9.6.1.3 Data Types
Variables and stored data can be configured with various data types to optimize
program execution and memory usage.
The declaration of variables (via the DIM or the PUBLIC statement) allows an
optional type descriptor AS that specifies the data type. The default data type,
without a descriptor, is IEEE4 floating point (FLOAT). Variable data types are
STRING and three numeric types: FLOAT, LONG, and BOOLEAN. Stored
data has additional data type options FP2, UINT2, BOOL8, and NSEC.
EXAMPLE 9.6-2 shows these in use in the declarations and output sections of
a CRBASIC
program.
EXAMPLE 9.6-2. CRBASIC Code: Data Type Declarations
'Float Variable Examples
Public Z
Public X As Float
Public CR1000Time As Long
'Long Variable Example
Public PosCounter As Long
Public PosNegCounter As Long
'Boolean Variable Examples
Public Switches(8) As Boolean
Public FLAGS(16) As Boolean
'String Variable Example
Public FirstName As String * 16 'allows a string up to 16 characters long
DataTable (TableName,True,-1)
'FP2 Data Storage Example
Sample (1,Z,FP2)
'IEEE4 / Float Data Storage Example
Sample (1,X,IEEE4)