[求助] MC9S08AW60 FLASH擦写问题
- UID
- 527438
- 性别
- 男
|
[求助] MC9S08AW60 FLASH擦写问题
FLASH的擦写要把代码拷到RAM中么? 下面是我的代码: 代码起始位置0XF000,擦写地址0x1A00,全速运行时为什么代码会跑飞啊? 请各位高人帮忙指点下 void flash(void) { byte temp; FSTAT = FSTAT | 0x10; FCDIV = 0x13;
if (FSTAT&0x10)//Check to see if FACCERR is set { FSTAT = FSTAT | 0x10; //write a 1 to FACCERR to clear } (*((volatile unsigned char *)(0x1A00))) = 0x00; FCMD =0x40; FSTAT_FCBEF = 1; asm nop; asm nop; asm nop; asm nop; if (FSTAT&0x30)//check to see if FACCERR or FVIOL are set { //return 0xFF; //if so, error. temp=0xff; } while (!(FSTAT&0x40)); //else wait for command to complete asm nop;
delay(5000);
if (FSTAT&0x10)//Check to see if FACCERR is set { FSTAT = FSTAT | 0x10; //write a 1 to FACCERR to clear } (*((volatile unsigned char *)(0x1A00))) = 0x00; FCMD = 0x20; FSTAT_FCBEF = 1; asm nop; asm nop; asm nop; asm nop; if (FSTAT&0x30)//check to see if FACCERR or FVIOL are set { //return 0xFF; //if so, error. temp=0xff; } while (!(FSTAT&0x40)); //else wait for command to complete asm nop; asm JMP 0x18fd; } |
|
|
|
|
|
- UID
- 104380
- 性别
- 男
|
对FLASH进行操作时应该将程序调入RAM中运行。 |
|
|
|
|
|