代码:
#include "msp430x54x.h"
unsigned int count;
void main(void)
{
WDTCTL = WDTPW + WDTHOLD; // Stop WDT
P2DIR |= BIT2; // P2.2 output
P2SEL |= BIT2; // P2.2 options select
TA1CCR0 = 512-1; // PWM Period
TA1CCTL1 = OUTMOD_7; // CCR1 reset/set
TA1CCR1 = 384; // CCR1 PWM duty cycle
TA1CTL = TASSEL_1 + MC_1 + TACLR; // ACLK, up mode, clear TAR
TA1CTL = TAIE;
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3
}
#pragma vector = TIMER1_A1_VECTOR
__interrupt void TIMER1_ISR()
{
switch(TA1IV)
{
case 0: break;
case 2: break;
case 4: break;
case 6: break;
case 8: break;
case 10: break;
case 12: break;
case 14: count++; break;
}
}
用的是5438,
哪位大侠帮帮我