static void FnCmdInRam_(byte Command_)
{
unsigned char delay_time=0;
FCMD = Command_; /* Initiate command */
// FSTAT = 0x80; /* Launch the command */
FSTAT |= 0x80;
// FSTAT_FCBEF=1;
for(delay_time=0;delay_time<100;delay_time++)
{
asm nop; /* Wait at least four bus cycles before checking FSTAT */
asm nop;
asm nop;
asm nop;
// asm nop; /* Wait at least four bus cycles before checking FSTAT */
// asm nop;
// asm nop;
// asm nop;
}
if (!(FSTAT & BM_FLASH_ERR_MASK)) { /* If no protection violation or access error detected */
while (!FSTAT_FCCF) {} /* Wait for command completion */
}
return;
}
这是我存到ram的erase程序 |