Keil 51里面的
定义一个绝对地址数组
#define SECTOR1 0x0800 //0800~0fff
#define SECTOR2 0x1000 //1000~17ff
#define SECTOR3 0x1800 //1800~1fff
#define SECTOR4 0x2000 //2000~27ff
#define SECTOR5 0x2800 //2800~2fff
#define SECTOR6 0x3000 //3000~37ff
#define SECTOR SECTOR2 //***
//devide one flash sector
#define FLASH_PAGE_BYTES 8 //**
//
#define FLASH_PAGE_COUNT 2048/FLASH_PAGE_BYTES
//allocate flash eeprom area at ROM sector 6 (C:0x3000~C:0x37ff)
typedef struct
{
Byte RecordFlag; /*RecordFlag == 0 ==> Record is empty;RecordFlag !=0 ==> Record is not empty*/
Byte ROM[FLASH_PAGE_BYTES-1];
}FLASH_MEMORY;
FLASH_MEMORY code Flash[FLASH_PAGE_COUNT] _at_ SECTOR;
|