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.

msp430 adc

Other Parts Discussed in Thread: MSP430F155

Hi I am bit new to msp430 controller,

     In my project i am using msp430f155 controller.....In adc if i use external reference my result will be correct ....but if  i am using internal reference  generator my answer is some what wrong...my input analog signal is 0.5V and external reference is 3.06V and the conversion answer is near to input signal(0.499V)....but in my internal reference case 0.5v and REF2_5V(2.5V) i got 0.410V......this my coding so please help ...

    Thank YOU........!

WDTCTL = WDTPW+WDTHOLD;                  
  P6SEL = 0x01;                            
  ADC12CTL0 = ADC12ON+SHT0_8;      
                                           
  ADC12CTL1 = SHP;               
  ADC12MCTL0 = INCH_0;                    
                 
  ADC12IE = 0x01;                          
  ADC12CTL0 |= ENC;                        
  ADC12CTL0 |= ADC12SC;      

  • It looks that you may have enabled the internal reference but forgot to configure the ADC to use it.

    For the conversion, you still use VCC (~3.0V) as reference, the so the calculated 4.1V will in fact be ~0.492V which seems correct.

    Independently of chosing 1.5V or 2.5V reference, you'll need to select 'VRef' as reference for the actual conversion.
    If you don't you'll still use VCC as reference. And you did so too when you thought you'd use an external reference.

    You'll need to set the reference to use in the ADC12MCTLx register in addition to enabling the internal reference (REFON bit) and selecting 2.5V by setting REF2_5V (which I don't see you doing in your posted code  too)

    Also, you set ADC12IE.0 for enabling interrupts. Did you set GIE too to allow interrupts? And do you have an ISR for it? If not, you should drop this line.

**Attention** This is a public forum