This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

写 flash

各位大侠:我读了一个TI 的软件,是写FLASH 的,我想问的是 FCTL1 = FWKEY + ERASE + 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
}

  • 也不知道擦除中断的向量是多少!

  • 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.

    没用过其它型号,只用过G2系列,G2系列好像没有这个设置标志位,G2系列好像擦除过程中要禁止其它中断源

    这里是不是用来允许其它中断?响应其它中断的时候擦除过程暂停,其它中断完成后擦除继续进行?

  • 段擦除会被pending的中断打断,这个不是flash擦除的中断,而是其他的中断

x 出现错误。请重试或与管理员联系。