#include
unsigned long int Freq;
unsigned int TA_OverflowCnt;
void main()
{
WDTCTL=WDT_ADLY_1000;
P1DIR&=~BIT1;
P1SEL|=BIT1;
IE1|=WDTIE;
_EINT();
while(1)
{
LPM3;
Freq=(TA_OverflowCnt*65536+TAR);
TA_OverflowCnt=0;
TACTL=TASSEL_0+MC_2+TAIE+TACLR;
}
}
#pragma vector=WDT_VECTOR
__interrupt void WDT_ISR()
{
LPM3_EXIT;
}
#pragma vector=TIMER0_A0_VECTOR
__interrupt void TA_ISR()
{
switch (TAIV)
{
case 2: break;
case 4: break;
case 10: TA_OverflowCnt++;
break;
}
}
贴代码的时候最好有备注,有说明,否则这代码没有价值