This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

MSP430F2132 ADC10 + PWM

Hi, 

I'm trying to put in the same program  PWM and ADC10 .
The two codes  work fine into different programs, but in the same program when the ADC conversion starts the PWM stops. 
Anyone can help me?
Those are the functions that i implemented:
******************************************************************************************************************************
*********************ADC10 Configuration**********************
void adc_Configuration(void)
{
  P1DIR |= 0x10;                        // Set P1.4 to output direction
  P1OUT &= 0xEF;                      //  P1.4 
  
  ADC10CTL1 = INCH_4 + ADC10DIV_3 + CONSEQ_2; //A4 /4 Reapet-single-chanel
  ADC10CTL0 = SREF_0 + ADC10SHT_3  + MSC + REFON  + ADC10ON + ADC10IE; 
  ADC10AE0 |= 0x10;                         // P2.4 ADC A4 option select
  
  ADC10DTC1 = 0x0A;                         // 10 conversions
}
 
**********************ADC10 INIT***************************************
void adc_init(void)
{
    ADC10CTL0 &= ~ENC;                      //
    while (ADC10CTL1 & BUSY);               // Wait if ADC10 core is active
    ADC10SA = 0x200;                        // Data buffer start
    ADC10CTL0 |= ENC + ADC10SC;             // Sampling and conversion start
}
*******************PWM CONFIGURATION**********************************
void PWM_Configuration(void)
{
   P1DIR |= 0x08;                             // P1.3 output
   P1SEL |= 0x08;                             // P1.3 TA0.2 otions
   /* PWM Configuration*/
   TA0CCR0 = PWM_freq;                      // PWM freq=512Hz
   TA0CCTL2 = OUTMOD_7;                  // TA0CCR2 reset/set
   TA0CTL = TASSEL_1 + MC_1;          // ACLK, up mode
 
}
*******************SET PWM************************************
void Set_PWM(unsigned int pwm)
{
if(pwm==100)
{
   P1SEL = P1SEL & 0xF7;                             // P1.3 I/O
    P1OUT=0x08;
}
else 
pwm_dt=(((100-pwm)/10));
pwm_dt=(pwm_dt*PWM_freq)/10;
TA0CCR2 = pwm_dt;
_no_operation();
******************MAIN PROGRAM****************************
void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  P1DIR |= 0x10; // Set P1.4 to output direction
  P1OUT =~ 0x10; // Toggle P1.4           
 Clk_Configuration();
 TIM1_A_Configuration();
 PWM_Configuration();
 adc_Configuration();
 
__enable_interrupt( );
 while(1)
{
if(segundos==20)
{
minutos++;
adc_init();
Set_PWM(10);
segundos=0;
}
}
}
********************************************************************************************************************************
Thanks in advance for helping.
Regards, 
Clara

**Attention** This is a public forum