#define FLASH(x) (*((volatile unsigned char *) 0x8000 + x)) /*---------------------------------------------------------- 另类的"数组"访问,外扩的SST39VF800A从0x8000开始 void FlashObj::ChipErase(void) { FLASH(0x5555) = 0xaa; FLASH(0x2AAA) = 0x55; FLASH(0x5555) = 0x80; FLASH(0x5555) = 0xaa; FLASH(0x2AAA) = 0x55; FLASH(0x5555) = 0x10; Wait(0x5555); } void FlashObj::Wait(unsigned int address) { unsigned int temp, val; do { val = FLASH(address); __nop(); temp = FLASH(address); __nop(); } while(((val ^ temp) & (1 << BIT6)) != 0); } ----------------------------------------------------------*/
|