各位大侠:我读了一个TI 的软件,是写FLASH 的,我想问的是 FCTL1 = FWKEY + ERASE + EEI 中使能 EEI 擦除中断的意义?没看到有中断响应程序,也不知道中断的入口地址,所以不懂设中断的意义,谢谢指点!
.void write_SegD(char value)
{
char *Flash_ptr; // Flash pointer
unsigned int i;
Flash_ptr = (char *)0x1000; // Initialize Flash pointer
FCTL3 = FWKEY; // Clear Lock bit
FCTL1 = FWKEY + ERASE + EEI; // Set Erase bit, allow interrupts???????
*Flash_ptr = 0; // Dummy write to erase Flash seg
FCTL1 = FWKEY + WRT; // Set WRT bit for write operation
for (i = 0; i < 64; i++)
{
*Flash_ptr++ = value; // Write value to flash
}
FCTL1 = FWKEY; // Clear WRT bit
FCTL3 = FWKEY + LOCK; // Set LOCK bit
}
这个问题驼鸟蝈蝈回答过,但我觉的他回答的不对,他说“这个不是flash擦除的中断,而是其他的中断”,手册上描述EEI位如下:
EEI Bits 3 Enable Erase Interrupts. Setting this bit allows a segment erase to be interrupted by an interrupt request. After the interrupt is serviced the erase cycle is resumed.
0 Interrupts during segment erase disabled.
1 Interrupts during segment erase enabled.
Peter_Zheng:
When EEIEX = 1 and GIE = 1, an interrupt will immediately abort any flash operation and the FAIL flag will
be set. 这是对其他中断的快速响应