User manual

164
mikoC PRO for dsPIC
MikroElektronika
Types Efciency
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 mikroC PRO for dsPIC30/33 and PIC24 is capable of handling types like char or
short, dsPIC30/33 and PIC24 will generate a better code for 16-bit types, like int. Therefore, use char and short only in
places where you can signicantlly save RAM (e.g. for arrays char a[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 mikroC 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. mikroC PRO for dsPIC30/33 and PIC24 can
allocate more than 32KByte of constants. See near and far memory speciers.
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 (int, long, oat, double, long double) 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.