User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
167
Memory Type Speciers
The mikroC PRO for PIC32 supports usage of all memory areas.
Each variable may be explicitly assigned to a specic memory space by including a memory type specier in the
declaration, or implicitly assigned.
The following memory type speciers can be used:
- code
- data
- rx (reserved for compiler purposes only)
- sfr
code
Description The code memory type may be used for allocating constants in program memory.
Example
// puts txt in program memory
const code char txt[] = “ENTER PARAMETER:”;
data
Description This memory specier is used when storing variable to the Data RAM.
Example
// puts x in data ram
data unsigned char x;
rx
Description This memory specier allows variable to be stored in the working registers space (reserved for compiler
purposes only).
Example
// puts y in working register space
rx char y;
sfr
Description This memory specier allows user to access special function registers. It also instructs compiler to
maintain same identier in source and assembly.
Example
sfr char y; // puts y in SFR space
Note: If none of the memory speciers are used when declaring a variable, data specier will be set as default by the
compiler.
Related topics: PIC32 Memory Organization, Accessing individual bits, SFRs, Constants, Functions