MS51 Pin Interrupt 唤醒低功耗模式示例
// / File Function: MS51 pin interrupt wakeup power down mode / // #include "MS51_16K.H"
void PinInterrupt_ISR (void) interrupt 7 { push(SFRS);
if (PIF&=SET_BIT0)
{
P12 ^= 1;
CLEAR_PIN_INTERRUPT_PIT0_FLAG;
}
if (PIF&=SET_BIT3)
{
P12 ^= 1;
CLEAR_PIN_INTERRUPT_PIT3_FLAG;
}
pop(SFRS); } /****************************************************************************** The main C function. Program execution starts here after stack initialization. ****************************************************************************/ void main (void) { BOD_DISABLE; / Disable BOD for less power consumption/
P12_QUASI_MODE;
P00_QUASI_MODE;
P03_INPUT_MODE;
/----------------------------------------------------/ /* Keep in power down mode unless trig setting GPIO / /----------------------------------------------------*/ ENABLE_INT_PORT0; ENABLE_BIT0_FALLINGEDGE_TRIG; ENABLE_BIT3_BOTHEDGE_TRIG; ENABLE_PIN_INTERRUPT; ENABLE_GLOBAL_INTERRUPT;
while(1)
{
set_PCON_PD;
}
}
原文地址: https://www.cveoy.top/t/topic/m8T0 著作权归作者所有。请勿转载和采集!