用JTAG调试,TIMERA1_VECTOR中断只发生一次,就不发生了,问题出来哪里?
#include <msp430x20x2.h> #include "VLO_Library.h" #include "intrinsics.h"
unsigned int dco_delta; unsigned long F_VLOCLK; unsigned int TACCR0_INIT;
int main(void) { WDTCTL = WDTPW +WDTHOLD; // Stop Watchdog Timer P1DIR |= 0x11; // P1.0,1,4 outputs P1SEL |= 0x10; // P1.4 = SMCLK
BCSCTL3 |= LFXT1S_2; // ACLK = VLO BCSCTL1 = CALBC1_8MHZ; // 8MHz cal value DCOCTL = CALDCO_8MHZ; // 8MHz cal value __delay_cycles(100); dco_delta = TI_measureVLO(); // dco delta = number of // 1MHz cycles in 8 ACLK cycles F_VLOCLK=8000000UL / dco_delta; //VLO时钟频率 TACCR0_INIT=F_VLOCLK/100-1; //TACCTL0 = CCIE; TACCR0 = TACCR0_INIT; TACTL = TASSEL_1 + MC_1 + TAIE; //ACLK作为时钟源,不分频,开TIMERA1中断 P1OUT = 0x01; __enable_interrupt(); while(1); }
#pragma vector=TIMERA1_VECTOR __interrupt void Timer_A(void) { if(TAIV==10) { P1OUT ^= 0x01; // 50HZ输出??
} }
|