Datasheet

rx
io
sfr
Note: If none of the memory specifiers are used when declaring a variable, data specifier will be
set as default by the compiler.
Related topics: AVR Memory Organization, Accessing individual bits, SFRs, Constants, Func-
tions
118
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
AVR Specifics
mikroC PRO for AVR
CHAPTER 4
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
sfr char rx y;
Description This memory specifier allows user to access the I/O Memory space.
Example
// put PORTB in io memory space
sfr io unsigned short PORTB absolute 0x38;
Description
This memory specifier in combination with (rx, io, data) allows user to
access special function registers. It also instructs compiler to maintain same
identifier in C and assembly.
Example
sfr io unsigned short PORTB absolute 0x38; // put PORTB in I/O
memory space
sfr rx char y; // puts y in Rx space sfr data unsigned
short PORTG absolute 0x65; and sfr unsigned short PORTG absolute
0x65;
are equivalent, and put PORTG in Extended I/O Space.