#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);
}
----------------------------------------------------------*/
在此非常感谢simon21ic对宏bug的纠错!!!
hotpower 发表于 2008-5-18 07:27 侃单片机 ←返回版面 | |
41楼: 非常感谢simon21ic对宏bug的纠错!!! | |
|
文章评论(0条评论)
登录后参与讨论