User manual

204
mikoBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
Simple Types
Simple types represent types that cannot be divided into more basic elements and are the model for representing
elementary data on machine level. Basic memory unit in mikroBasic PRO for dsPIC30/33 and PIC24 has 16 bits.
Here is an overview of simple types in mikroBasic PRO for dsPIC30/33 and PIC24:
Type Size Range
bit
1–bit 0 or 1
sbit
1–bit 0 or 1
byte, char
8–bit 0 .. 255
short
8–bit -127 .. 128
word
16–bit 0 .. 65535
integer
16–bit 32768 .. 32767
longword
32–bit 0 .. 4294967295
longint
32–bit 2147483648 .. 2147483647
oat
32–bit ±1.17549435082 * 10
-38
.. ±6.80564774407 * 10
38
You can assign signed to unsigned or vice versa only using the explicit conversion. Refer to Types Conversions for
more information.
Derived Types
The derived types are also known as structured types. They are used as elements in creating more complex user-
dened types.
The derived types include:
- arrays
- pointers
- structures
Arrays
An array represents an indexed collection of elements of the same type (called the base type). Since each element has
a unique index, arrays, unlike sets, can meaningfully contain the same value more than once.
Array Declaration
Array types are denoted by constructions in the following form:
type[array_length]
Each of the elements of an array is numbered from 0 through array_length - 1.
Every element of an array is of type and can be accessed by specifying array name followed by element’s index within
brackets.