Mikroelektronika MIKROE-442 Datenbogen
mikroBasic PRO for dsPIC30/33 and PIC24
MikroElektronika
167
Types Efficiency
First of all, the user should know that dsPIC30/33 and PIC24’s ALU, which performs arithmetic operations, is optimized
for working with 16-bit types. Although mikroBasic PRO for dsPIC30/33 and PIC24 is capable of handling types like
byte, char
or
short
, dsPIC30/33 and PIC24 will generate a better code for 16-bit types
word
and
integer
type so use
byte, char
and
short
only in places where you can significantlly save RAM (e.g. for arrays
dim a
as byte[30]
).
Nested Calls Limitations
There are no Nested Calls Limitations, except by RAM size. A Nested call represents a function call within the function
body, either to itself (recursive calls) or to another function.
Recursive calls, as a form of cross-calling, are supported by mikroBasic PRO for dsPIC30/33 and PIC24, but they
should be used very carefully due to dsPIC30/33 and PIC24 stack and memory limitations. Also calling functions
from interrupt is allowed. Calling function from both interrupt and main thread is allowed. Be carefull because this
programming technique may cause unpredictable results if common resources are used in both main and interrupt.
Limits of Indirect Approach Through PSV
Constant aggregates are stored in Flash and are accessible through PSV. mikroBasic PRO for dsPIC30/33 and PIC24
can allocate more than 32KByte of constants. See
near
and
far
memory specifiers.
Limits of Pointer to Function
Currently pointer to functions are 16-bit variables. For functions which address exceeds 16 bit limit, the compiler uses
handle (16-bit pointer on GOTO). A handle usage is automatic compiler process so there is no need for the user to
intervene.
Variable, constant and routine alignment
Simple type variables whose size exceeds 1 byte (
word, integer, dword, longint, real
) are always set to
alignment 2 (i.e. are always allocated on even address).
Derived types and constant aggregates whose at least one element exceeds size of 1 byte are set to alignment 2.
Routines are always set to aligment 2.