在看Flash例程中,碰到 S8 Flash_Erase_Sector(U32 far_address) { U16* address;
address = (U16*)far_address; // Strip page off
if( (U16)address & 0x0001 ) // Aligned word? i.e. address must be even address { return Flash_Odd_Access; } if( (U16)address % Flash_Sector_Size !=0 ) { return Not_StartofSector_Error; }
/* Only Block 0 can be erased */ FCNFG = 0;
FSTAT = FSTAT_ACCERR|FSTAT_PVIOL; //Clear errors
(*address) = 0xFFFF; // Dummy store to page to be erased FCMD = ERASE; 程序未完 看到 (*address) = 0xFFFF; // Dummy store to page to be erased 这一句不是很明白,请大虾帮忙解释下在Falsh进行扇区擦除时候,在写入擦除命令前,这句程序为什么不可少,做什么的?谢谢了 |