int main(void)
{
//WDTCTL = WDTPW | WDTHOLD;
WDTCTL = WDTPW+WDTCNTCL+WDTSSEL0+WDTIS2;//复位时间 1s
SYS_Init();
SYSCFG0 = FRWPPW|DFWP;
restart++;
SYSCFG0 = FRWPPW|PFWP | DFWP;
while(1)
{
TA0R = Timer0Cunt;
//使能Timer0//////////
TA0CCR0 = 16384;
TA0CTL = TASSEL_1 | MC__UP; // ACLK, UP mode
TA0CCTL0 |= CCIE; // TACCR0 interrupt enabled
//////////////////////
tmp_count++;
Comm_Process(); //通讯处理
Error_Check();
MeterDateWrite();
//关闭Timer0//////////
TA0CCTL0 = 0;
TA0CTL = 0;
TA0CCR0 =0;
//////////////////////
Timer0Cunt = TA0R;
WDTCTL = WDTPW | WDTHOLD;
__bis_SR_register(LPM4_bits|GIE); // Enter LPM
__no_operation(); // For debugger
}
}
#pragma vector=PORT2_VECTOR
__interrupt void Port_2 (void)
{
Pluse_Cont();
WDTCTL = WDTPW+WDTCNTCL+WDTSSEL0+WDTIS2;//复位时间 1s
__bic_SR_register_on_exit(LPM4_bits); // Exit LPM0 on reti
}
#pragma vector=USCI_A0_VECTOR
__interrupt void USCI_A0_ISR(void)
{
UART_Rece();
WDTCTL = WDTPW+WDTCNTCL+WDTSSEL0+WDTIS2;//复位时间 1s
__bic_SR_register_on_exit(LPM4_bits); // Exit LPM0 on reti
}
#pragma vector = TIMER0_A0_VECTOR
__interrupt void Timer_A (void)
{
tmp_count1++;
WDTCTL = WDTPW+WDTCNTCL+WDTSSEL1+WDTIS2;
}
求大神知道怎么降低功耗
此帖出自
小平头技术问答
一周热门 更多>