Mikroelektronika MIKROE-350 Fiche De Données

Page de 526
MEMORY TYPE SPECIFIERS
The mikroBasic PRO for AVR supports usage of all memory areas. Each variable may be explic-
itly assigned to a specific memory space by including a memory type specifier in the declaration,
or implicitly assigned. 
The following memory type specifiers can be used:
- code 
- data 
- rx 
- io 
- sfr 
- register 
Memory type specifiers can be included in variable declaration. 
For example:
dim data_buffer as byte data
' puts data_buffer in data ram
const txt = "Enter parameter" code
' puts text in program memory
code
data
rx
107
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
8051 Specifics
mikroBasic PRO for AVR
CHAPTER 4
Description The code memory type may be used for allocating constants in program memory.
Example
' puts txt in program memory 
const txt = "Enter parameter" code
Description This memory specifier is used when storing variable to the internal data SRAM.
Example
' puts data_buffer in data ram
dim data_buffer as byte data
Description
This memory specifier allows variable to be stored in the Rx space (Register file).
Note: In most of the cases, there will be enough space left for the user variables
in the Rx space. However, since compiler uses Rx space for storing temporary
variables, it might happen that user variables will be stored in the internal data
SRAM, when writing complex programs. 
Example
' puts y in Rx space  
dim as char rx