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.

[参考译文] MSPM0G3507:__WFI ()函数

Guru**** 1999175 points
请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

https://e2e.ti.com/support/microcontrollers/arm-based-microcontrollers-group/arm-based-microcontrollers/f/arm-based-microcontrollers-forum/1408895/mspm0g3507-__wfi-function

器件型号:MSPM0G3507

工具与软件:

HII

   在编写任何代码时,是否需要编写_WFI()函数?

我应该这样写吗?
  

int main()
  while (1)
  {
    if (flag == true)
    {
      transmit_msg()
      flag = false
    }
  }
}
void IRQ_Handler (void)
  flag = true
}
  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    只有当您要暂停主线程 并让 中断完成所有工作时,才需要使用_WFI()。

    您的代码最安全、因为 IRQ 处理程序可以快速进入和退出。 请注意、"标志"应为易失性。 但是、如果中断之间有很多时间、那么最好在处理程序中调用 transmit_msg()。

  • 请注意,本文内容源自机器翻译,可能存在语法或其它翻译错误,仅供参考。如需获取准确内容,请参阅链接中的英语原文或自行翻译。

    WFI 或 WFE 函数会等待中断/事件、就像 Keith 说的那样、它将暂停主线程、并将 CPU 置于您设置的低功耗模式。

    此致、
    Luke