Datasheet
FLASH_Read_Words
Library Example
The example demonstrates simple write to the flash memory for AVR, then reads the data and
displays it on PORTB and PORTD.
const long F_ADDRESS = 0x200;
const unsigned int data_[32] = { // constant table
0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007,
0x0008,0x0009,0x000A,0x000B,0x000C,0x000D,0x000E,0x000F,
0x0000,0x0100,0x0200,0x0300,0x0400,0x0500,0x0600,0x0700,
0x0800,0x0900,0x0A00,0x0B00,0x0C00,0x0D00,0x0E00,0x0F00,
} absolute 0x200;
char i;
unsigned int word;
unsigned int dat_buff[32];
void main() {
DDRD = 0xFF; // set direction to be output
DDRB = 0xFF; // set direction to be output
word = data_[0]; // link const table
280
MIKROELEKTRONIKA - SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroC PRO for AVR
CHAPTER 6
Prototype
// for MCUs with 64kb of Flash memory or less
void FLASH_Read_wWrds(unsigned int address, char *buffer,
unsigned NoWords);
// for MCUs with Flash memory larger than 64kb
void FLASH_Read_Words(unsigned long address, char *buffer,
unsigned NoWords);
Returns Nothing.
Description
Reads number of data words defined by NoWords parameter from the specified
address in Flash memory to varibale pointed by buffer.
Requires Nothing.
Example
// for MCUs with Flash memory larger than 64kb
const long F_ADDRESS = 0x200;
unsigned int dat_buff[32];
...
FLASH_Read_Words(F_ADDRESS,dat_buff, 32);