User`s manual

Array is a set of data stored in consecutive memory locations. Defining an array
and manipulating its elements is simple. Elements of array are always of same
data type (any simple).
dim days_of_the_week as byte[7]
dim months as byte[12]
dim AD_Conversion_result as word[10]
First declaration above generates 7 variables of byte type. These can be accessed
by array name followed by number in the square brackets [] (this number is also
known as index). Indexing is zero based, meaning that in our example, index
spans numbers from 0 to 6. Instead of byte, you can define array of any other sim-
ple type (word, short, integer or longint).
Note that:
dim something as integer[10]
occupies 20 RAM locations (bytes), not 10.
You can use any kind of operator with array elements - Arithmetic Operators,
Logical (Bitwise) Operators, and Relation (Comparison) Operators. Technically,
array element is treated as a simple type. Also, instead of a number, index can be
any expression with result type of byte. For example:
m[a + b] = 90
m[1] = m[2] + 67
m[1] = m[2] div m[3]
When you declare an array, mikroBasic allocates a certain amount of RAM for it.
Elements of array consume consecutive RAM locations; in case of array of bytes,
if the address of m[0] is 0x23, m[1] will be at 0x24, and so on.
Accessing these elements is almost as fast as accessing any variable of simple
type. Instead of byte you can define array of any other simple type (word, short,
integer or longint). Don't forget that you are restricted by the amount of free space
in PIC RAM memory.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
32
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
Array
Array and
Operators
Array and
PIC