Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
FLASH_Read_Words
Library Example
The example demonstrates simple write to the flash memory for AVR, then reads the data and dis-
plays it on PORTB and PORTD.
program Flash_MCU_test;
const F_ADDRESS : longint = 0x200;
const data_ : array[32] of word = (                          // 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
); 
org 0x200;
var counter : byte;
word_ : word;
dat_buff : 
array[32] of word;
begin
DDRD := 0xFF;                              // set direction to be output
DDRB := 0xFF;                              // set direction to be output
word_ := data_[0];                        //  link const table
232
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Libraries
mikroPASCAL PRO for AVR
CHAPTER 6
Prototype
// for MCUs with 64kb of Flash memory or less
procedure FLASH_Read_Words(address : word; buffer : ^word;
NoWords : word); 
// for MCUs with Flash memory larger than 64kb
procedure FLASH_Read_Words(address : dword; buffer : ^word;
NoWords : word); 
Returns
Nothing.
Description
Reads number of data words defined by NoWords parameter from the specified
address in Flash memory to variable pointed by buffer.
Requires
Nothing.
Example
// for MCUs with Flash memory larger than 64kb
const F_ADDRESS : dword = 0x200;
var dat_buff : array[32] of word;
...
begin
FLASH_Read_Words(F_ADDRESS,dat_buff, 32);
end.