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.

MSP430f6638 Ref voltage by ADC12CTL0 or ADC12MCTL

Other Parts Discussed in Thread: MSP430F6636

Hi there are two registers ADC12CTL0 or ADC12MCTL can set the ADC REF voltage,  

ADC12REFON  and ADC12REF2_5V of ADC12CTL0

ADC12SREFx of ADC12MCTL

what is different between them? and I only can select one, right?

do you have some sample code of ADC application for MSP430f6636 ?

thanks

  • Hi Jim!

    Code examples for the processor can be downloaded here. For the ADC there are

    • msp430f66xx_adc_01.c              ADC12, Sample A0, Set P1.0 if A0 > 0.5*AVcc
    • msp430f66xx_adc_02.c              ADC12, Using the Internal Reference
    • msp430f66xx_adc_05.c              ADC12, Using an External Reference
    • msp430f66xx_adc_06.c              ADC12, Repeated Sequence of Conversions
    • msp430f66xx_adc_07.c              ADC12, Repeated Single Channel Conversions
    • msp430f66xx_adc_08.c              ADC12, Using A8 and A9 Ext Channels for Conversion
    • msp430f66xx_adc_09.c              ADC12, Sequence of Conversions (non-repeated)
    • msp430f66xx_adc_10.c              ADC12, Sample A10 Temp and Convert to oC and oF

    Dennis

  • Hello Jim,

    with the ADC12REF2_5V setting in ADC12CTL0 you can control the voltage level of the internal reference.

    With ADC12SREFx instead you control the reference which should be used for a ADC channel (e.g. AVcc/AVss or Vref+/AVss).

    The ADC12REFON bit and the ADC12REF2_5V bits can be used to control the internal reference but it is a better choice to control the internal reference with the bits in REFCTL0 register,

    Best regards,

    Michael
  •   if following code running, the A/D will convert only A0 to A2 or A0 to A7 ?

      ADC12CTL1 = ADC12SHP+ADC12CONSEQ_1;       // Use sampling timer, single sequence
      ADC12MCTL0 = ADC12INCH_0;                 // ref+=AVcc, channel = A0
      ADC12MCTL1 = ADC12INCH_1;                 // ref+=AVcc, channel = A1
      ADC12MCTL2 = ADC12INCH_2;                 // ref+=AVcc, channel = A2

    thanks

    jim

  • Hello Jim,

    in your example the ADC converts channel A0 to A2. For conversion of A0 to A7 you have to extend your example with:

    ADC12MCTL3 = ADC12INCH_3;

    ADC12MCTL4 = ADC12INCH_4;

    ADC12MCTL5 = ADC12INCH_5;

    ADC12MCTL6 = ADC12INCH_6;

    ADC12MCTL7 = ADC12INCH_7 + ADC12EOS;

    As you can see in the code you have to set the ADC12EOS-Bit for the last channel to indicate the end of the measurement sequence.

    Best regards,

    Michael

**Attention** This is a public forum