- UID
- 518196
- 性别
- 男
|
本帖最后由 xujicai 于 2010-9-24 23:27 编辑
下面的这段代码来自AN3275,作者想擦除Paged Memory of the block 0(except the page 0x3F):
------------------------------------------------------------------------------------------------------------------------------
PPAGE=0x3E;
li16PageAddressPointer=0xBFFF;
li16BootAddressPointer = 0xFFFF;
while(PPAGE>li8Page)
{
if(*(uint8 *)(li16BootAddressPointer) != *(uint8 *)(li16PageAddressPointer))
{
/*
* Erase Paged Memory
*/
gi32FlashAddressH = PPAGE;
for(gi32FlashAddressL=0xBF00;gi32FlashAddressL>=0x8000;gi32FlashAddressL-=0x200){
gi16FlashDataCounter = 1;
if (vfnFlash_Cmd(FErase))
{
vfnSCITxMsg(&gi8aFlashErrorMsg[0]);
return;
}
}
PPAGE--;
li16PageAddressPointer = 0xC000;
li16BootAddressPointer = 0x0000;
}
li16BootAddressPointer--;
li16PageAddressPointer--;
if(li16BootAddressPointer<0xF000){PPAGE = 0x36;}
}
------------------------------------------------------------------------------------------
不过我认为下面的这些代码就足可以了:
----------------------------------------------------------------------------------------------------
PPAGE=0x3E;
while(PPAGE>li8Page)
{
gi32FlashAddressH = PPAGE;
for(gi32FlashAddressL=0xBF00;gi32FlashAddressL>=0x8000;gi32FlashAddressL-=0x200){
gi16FlashDataCounter = 1;
if (vfnFlash_Cmd(FErase))
{
vfnSCITxMsg(&gi8aFlashErrorMsg[0]);
return;
}
}
PPAGE--;
}
---------------------------------------------------------------------------------------------------------------
请教一下,作者多出的那些代码有什么用途呢, thanks! |
|