[求助]9s12dg128 flash擦除$ff00-$ffff的问题
- UID
- 15056
- 性别
- 男
|
[求助]9s12dg128 flash擦除$ff00-$ffff的问题
当我写flash地址$ff00-$ffff的时候程序老是会跳到$0000处是什么意思?具体函数是这样的 byte EraseSector(word Addr) { EnterCritical(); /* Enter critical section */ ClearFlags(); FCNFG_BKSEL=0; /* Clear all flags */ //SelectBank(Addr); /* Select bank and page */ if (FSTAT_CBEIF == 0) { /* Is command buffer full ? */ ExitCritical(); /* Exit critical section */ return ERR_BUSY; /* If yes then error */ } *(word *) Addr = IFsh1_DummyData; /* Write eny word to FLASH buffer */ FCMD = 64; /* Initiate Sector Erase commamd */ FSTAT = 128; asm { /* Jump to Wait in RAM code */ JSR WaitInRAMcode1 } /* Clear flag command buffer empty */ if ((FSTAT_PVIOL == 1)||(FSTAT_ACCERR == 1)) { /* Is protection violation or access error detected ? */ ExitCritical(); /* Exit critical section */ return ERR_NOTAVAIL; /* If yes then error */ } FCNFG_CCIE = 1; /* Enable interrupt */ while (FSTAT_CBEIF == 0); /* Wait to buffer empty */ while (FSTAT_CCIF == 0); /* Wait to command complete */ ExitCritical(); /* Exit critical section */ return ERR_OK; /* OK */ } 版主看看这段代码有什么需要改的么?
|
|
|
|
|
|
- UID
- 104380
- 性别
- 男
|
你的程序应该是执行JSR WaitInRAMcode1时跳到$0000处的吗?你的WaitInRAMcode1函数地址放对了吗? |
|
|
|
|
|
- UID
- 15056
- 性别
- 男
|
|
|
|
|
|
- UID
- 104380
- 性别
- 男
|
FLASH时钟频率对不对?另外要注意FLAH操作程序不能对自己的BLOCK块进行操作。 |
|
|
|
|
|