#include "msp430x54x.h"
void main(void) { WDTCTL = WDTPW + WDTHOLD; // Stop WDT P1DIR |= 0x01; // P1.0 output TA1CTL = TASSEL_1 + MC_1 + TACLR + TAIE; // ACLK, contmode, clear TAR TA1CCR1= 5000; TA1CCR0= 65535; TA1CCTL1|=CCIE;
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3, enable interrupts __no_operation(); // For debugger }
// Timer_A3 Interrupt Vector (TAIV) handler #pragma vector=TIMER1_A1_VECTOR __interrupt void TIMER1_A1_ISR(void) { switch(__even_in_range(TA1IV,14)) { case 0: break; // No interrupt case 2: P1OUT ^= 0x01; break; case 4: break; // CCR2 not used case 6: break; // reserved case 8: break; // reserved case 10: break; // reserved case 12: break; // reserved case 14: break; default: break; } }
我的目的是利用捕获/比较模块1的中断来实现灯的闪烁,但改变TA1CCR1的值,灯闪烁频率未变,改变TA1CCR0的值,灯的闪烁频率改变,不知道错在哪
急~~
|