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.

f2272 ADC error

Other Parts Discussed in Thread: MSP430F2272

Hi,  have a problem with the ADC 10 of the MSP430F2272,

I want to enable the external 1.5V reference, and after the conversion i want to disable the external reference.

I can't use the REFBURST node because the device has to wait for a charge transient.(The out reference is used to supply the voltage of a NTC).

the trouble observed is that when the REFOUT is enabled , is impossible to disable it.

the code i use is wrotten below:

#include "msp430x22x4.h"

char cnt = 0;

void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;                 // Stop WDT
  ADC10AE1 = 0x10;       // P4.3 A12 analogic input
  ADC10CTL1 = INCH_12;                      // ch12
  ADC10CTL0 = SREF_0 + ADC10SHT_2 + REFON + ADC10ON;
  TACCR0 = 3000;                              // Delay to allow Ref to settle
  TACCTL0 |= CCIE;                          // Compare-mode interrupt
  TACTL = TASSEL_1 + MC_1 + ID_3;                  // TACLK = SMCLK, Up mode
  __bis_SR_register(CPUOFF + GIE);          // LPM0, TA0_ISR will force exit
  TACCTL0 &= ~CCIE;                         // Disable timer Interrupt
  P1DIR |= 0x01;                            // Set P1.0 to output direction
  //P2DIR |= 0x10;
  for (;;)
  {
   //P2OUT = 0x10;
   P2REN &= ~0x10;
   
   
   ////////   abilito la tensione di rigerimento esterna
   //enable REFOUT
   
   
    ADC10CTL0 |= SREF_0 + ADC10SHT_2 + REFON + ADC10ON + REFOUT;             //
  
   //aspetto che il transitorio di carica finisca

//wait for transient
   while(cnt < 33)
   cnt++;
   cnt = 0;  
   
    //comincio la conversione

//start conversion
    ADC10CTL0 |= ENC + ADC10SC;
   
    while (ADC10CTL1 & ADC10BUSY);          // ADC10BUSY?
   
   
    //disable REFOUT
    //disabilito il riferimento esterno e interno di tensione per motivi di energy saving
   //ADC10CTL0 &= ~(REFON + REFOUT);
   ADC10CTL0 = 0x0000;       
   ADC10CTL0 &= ~ADC10IFG;
   ADC10CTL0 &= ~REFON;
   ADC10CTL0 &= ~ REFOUT;
  
   /*i can't put REFON and REFOUT = 0
    *perchè non riesco a disabilitare il riferimento di tensione?
    *
    *
    * ADC10CTL0 &= ~(REFON + REFOUT);
    * questa istruzione non funziona!!....i bit REFON e REFOUT di ADC10CTL0 non vanno a 0.
    * come mai?
    *
    *
    * //i try with all these instruction, but REFOUT remains always = 1
    * //
    *    ADC10CTL0 = 0x0000;       
     ADC10CTL0 &= ~ADC10IFG;
     ADC10CTL0 &= ~REFON;
     ADC10CTL0 &= ~ REFOUT;
     ma non riesco a portare a 0 i bit del registro.
     *
     *
     * In piu non posso usare ref burst perchè il riferimento esterno (che ha come carico una res da 15k e un C da 22nF)
     *  non raggiunge la tensione 1.5V durante la conversione
     *
  
   */
  
   //attivo pull down per bloccare a 0 la tensione nel pin VREF+ (P2.4).
   P2REN |= 0x10;
  
    if (ADC10MEM < 0x311)                   // ADC10MEM = A11 > 1.15V?
      P1OUT &= ~0x01;                        // Set P1.0 LED on
    else
      P1OUT = 0x01;                       // Clear P1.0 LED off
      //P2OUT= 0;
     
   while(cnt < 250)
   cnt++;

   cnt = 0;  
  }
}

#pragma vector=TIMERA0_VECTOR
__interrupt void TA0_ISR(void)
{
  TACTL = 0;                                // Clear Timer_A control registers
  LPM0_EXIT;                                // Exit LPM0 on return
}

 

HELP me please!

Federico

 

  • Please, someone can try this simple code?...is a very falks behaviour..

  • Hi Michael,

                       What exactly ur application needs?

                       Have u read ADC10 chapter in msp430x2xx guide?

                      ADC10CTL0 &= ~ REFOUT;    this  statement is enough for disabling the REFOUT

                     of course not much important use #include "msp430x22x2.h"  instead of  #include "msp430x22x4.h".

                       if possible please paste the code without any unnecessary things  so that one can easily understand , and can rectify ur problem.

     

    Regards,

    Kshatriya

     

**Attention** This is a public forum