Hello,
I'm trying to execute a relatively simple code to generate a set of 14 pulses using the MPS430F5342 controller. The code i've used to generate these pulses is given below.
#include <msp430.h>
unsigned int i = 0;
int main(void)
{
WDTCTL = WDTPW + WDTHOLD; //Disable Watchdog timer
P1DIR = 0x02; //Port 1.1 to Output
P1SEL = 0x02; //TA0.0 Special Function
TA0CCR0 = 1000; //Set CCR0
TA0CCR1 = 500; //Set CCR1
TA0CCTL0 = OUTMOD_3; //Set/Reset Output Mode
TA0CTL = TASSEL_1 + MC_1; //ACLK Clock Source, Up mode
__bis_SR_register(GIE); //Interrupt Enable
while(1);
}
#pragma vector=TIMER0_A1_VECTOR
__interrupt void TIMER0_A1_ISR(void)
{
i++;
if (i>=14) //14 Pulse Check
{
TA0CTL = 0x0000; //timer A disable
}
}
The issue is that the PWM is generated but it doesn't stop generating the pulse. Any help will be appreciated. Thanks.