#include
void delay(int x)
{
int i,j;
for(i=x;i>0;i--)
for(j=112;j>0;j--);
}
int main( void )
{
// Stop watchdog timer to prevent time out reset
BCSCTL1 |= DIVA_2;
WDTCTL = WDT_ADLY_1000;
IE1 = WDTIE;
P2DIR |= BIT2;
P2OUT |= BIT2;
while(1)
{
_BIS_SR(LPM3_bits+GIE);
P2OUT &= ~BIT2;
delay(100);
P2OUT |= BIT2;
}
}
#pragma vector = WDT_VECTOR
__interrupt void watchdot_timer()
{
_BIC_SR_IRQ(LPM3_bits);
}
『本文转载自网络,版权归原作者所有,如有侵权请联系删除』