TI中文支持网
TI专业的中文技术问题搜集分享网站

5529测频进不了中断问题。

void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P1SEL|=BIT2;
P1IE|=BIT2;// P1.0 output
P1IES=BIT2;
TA1CCTL0 = CM_1+SCS+CCIS_0+CAP+CCIE; // CCR0 interrupt enabled
TA1CCR0 = 60000-1;
TA1CTL = TASSEL_3 + MC_1 ; // SMCLK, contmode, clear TAR
WDTCTL=WDT_ADLY_1000;
SFRIE1|=WDTIE;
_EINT();

__bis_SR_register(LPM0_bits + GIE); // Enter LPM0, enable interrupts
__no_operation(); // For debugger
}

// Timer1 interrupt service routine
#if defined(__TI_COMPILER_VERSION__) || defined(__IAR_SYSTEMS_ICC__)
#pragma vector=TIMER1_A0_VECTOR
__interrupt void TIMER1_A0_ISR(void)
#elif defined(__GNUC__)
void __attribute__ ((interrupt(TIMER1_A0_VECTOR))) TIMER1_A0_ISR (void)
#else
#error Compiler not supported!
#endif
{
//xianshi();
Overflow_Cnt++; // Add Offset to CCR0
}
#pragma vector=WDT_VECTOR
__interrupt void watchdog_timer(void)
{
Frq=TA1R+60000*Overflow_Cnt;
TA1CTL = TACLR;
Overflow_Cnt=0;
}

为什么上升沿捕获触发中断不行,现在直接进不了中断。

HG:

1.检查timer的channel设置是否正确

2.检查对应的PIN是否有timer的功能

3. 检查Timer的配置

下面是在G2542上一个上升沿/下降沿触发的部分例程,供参考

void GPIO_Initial(){ P1DIR |= BIT3 + BIT5; P1OUT |= BIT5; P1SEL |= BIT3; // CAOUT P1SEL2 |= BIT3; P2DIR = 0x00; P2OUT &= ~BIT0; // P2.0 output0 P2DIR |= BIT0; // P2.0 output P2.1 input P2.2 input

}

void Comparator_Initial(){ Current_Channel = Channel_Refrence1; CACTL2 = P2CA3 + P2CA0 + CAF; // Comparator CACTL1 = CAON; // Comparator}

void TimerA_Initial(){ CCTL1 = CCIS_1 + CM0 + SCS + CAP + CCIE; // Timer, Initial pose-edge triggle CCIS_1 has to be set TACTL = TACLR + TASSEL_2 + TAIE + MC_2; //Timer, Continous up; capture refrence}void main (void){ WDTCTL = WDTPW + WDTHOLD; if (CALBC1_8MHZ ==0xFF || CALDCO_8MHZ == 0xFF) while(1); // Erased calibration data? Trap! BCSCTL1 = CALBC1_8MHZ; // Set range DCOCTL = CALDCO_8MHZ; // Set DCO step + modulation

GPIO_Initial(); Comparator_Initial(); TimerA_Initial(); _BIS_SR(LPM0_bits + GIE); // Enter LPM0

}

赞(0)
未经允许不得转载:TI中文支持网 » 5529测频进不了中断问题。
分享到: 更多 (0)