單片機(jī)中的WFI/WFE指令
進(jìn)入低功耗模式的兩個(gè)指令,這是ARM里CMSIS內(nèi)核中的指令。詳情請(qǐng)參考鏈接里大神們的討論鏈接http://www.wowotech.net/armv8a_arch/wfe_wfi.html
cmsis_arm.cc里有如下說(shuō)明
/**
brief Wait For Interrupt
details Wait For Interrupt is a hint instruction that suspends execution until one of a number of events occurs.
*/
#define __WFI __wfi
/**
brief Wait For Event
details Wait For Event is a hint instruction that permits the processor to enter
a low-power state until one of a number of events occurs.
*/
#define __WFE __wfe
什么意思呢?簡(jiǎn)單的說(shuō):
WFI進(jìn)入則可由任意中斷喚醒
WFE進(jìn)入則由事件喚醒
WFI = wait for interrupt 等待中斷,即下一次中斷發(fā)生前都在此hold住不干活
WFE = wait for event 等待事件,即下一次事件發(fā)生前都在此hold住不干活
執(zhí)行這兩條語(yǔ)句后CPU功耗會(huì)降低,通常用這兩條語(yǔ)句來(lái)省電。