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.

ADC12 channels affecting each other

Other Parts Discussed in Thread: MSP430F2619, LM3940

Hi there,

I am trying to use the ADC12 on an MSP430F2619 to measure two different input voltages constantly, on channels A0 and A1, storing these values in ADC12MEM0 and ADC12MEM1.  But I suspect that I have initialized something incorrectly, because when I test this (using the on-chip debugger in CCSv5.1), I find that the values are affecting each other. The A0 value is typically around 0x900 (from a sensor), but when the A1 channel voltage decreases (as seen in ADC12MEM1 and measured by a multimeter), so does the A0 channel measurement (in ADC12MEM0) to around 0x500, despite A0 having not changed voltage.

It doesn't seem right to me that the measurement for channel A0 should be a different value based on the channel A1 input, since A0 always is getting the same voltage.  What am I doing wrong?


My initialization is as follows, the program then runs in an infinite loop and (for now) I am pausing the debugger to measure values in ADC12MEM0 and ADC12MEM1

WDTCTL = WDTPW + WDTHOLD;                 // Stop watchdog timer
    P6SEL |= 0x03;                            // Enable A/D channel A0 and A1
    ADC12CTL0 = ADC12ON+MSC+SHT0_8;           // Turn on ADC12, set sampling time
    ADC12CTL1 = SHP+CONSEQ_3;                 // Use sampling timer, set mode
    ADC12MCTL0 = INCH_0;                      // ref+=AVcc, channel = A0
    ADC12MCTL1 = INCH_1 + EOS;                      // ref+=AVcc, channel = A1
    ADC12CTL0 |= ENC;                         // Enable conversions
    ADC12CTL0 |= ADC12SC;                     // Start conversion

I suspect that there is some sort of averaging going on when the values are stored in the MEM registers, but I'm not sure how I should go about measuring these voltages independently.

Thank you in advance!

  • Hi David,

    The code looks good to me.

    I noticed you chose a nice long sampling time (SHT0_8 gives 256 cycles of sampling), so it appears that you have considered your source impedance against the sampling capacitor etc.  You may want to double check that work, or lengthen the sampling time to see if there is any change in the symptoms.

    The other consideration besides sampling time is the reference.  You have chosen AVcc as the reference, so by chance it is changing?

    Jeff

  • David Zucker said:
    I suspect that there is some sort of averaging going on when the values are stored in the MEM registers

    No. The registers only hold the result of the previous conversion. No averaging/filtering. Also, there is only one ADC core, The inputs are multiplexed, and since you're sampling the two input alternating...
    Your code looks correct. So I suggest checking the impedance between the two pins with a multimieter. Maybe there is a low-impedance bridge between the two.
    Or A0 isn't soldered properly (high impedance),s when testing, you're metering the voltage on the line, but not the voltage on A0 8and the ADC is correct all the time - as far as the voltage is really applied to the pin)

    And where does your A1 voltage come from (and how much is it)?

    I used the ADC12 a lot for measuring independent voltages, and it worked. Well, not with exactly this MSP, but there shouldn't be much of a difference.

  • Thank you both for the replies, I will recheck my hardware then, since the problem is not in my code.

    A0 is the output from an IR range detector, which gives roughly between 0.5 and 2.7 volts

    A1 is the measuring pin from a resistive touch screen (measuring X direction only), which ranges between 0 and 3.3v based on where a stylus is pressed.

    Both of these devices work as expected with the ADC12 in single-channel repeated mode (with the other unplugged).

    Avcc is tied to DVcc at 3.3V (relative to Avss/Dvss/ 'GND'), provided from an LM3940 LDO voltage regulator (Stepping down from a wall plug that gives 5v), so these values are not changing.

    I will try a longer sampling time, and look for some unwanted connectivity between the two pins on my target board.  I will also try to move things around on the breadboard to make sure that I am getting the full effect of my decoupling capacitors.

  • David Zucker said:
    I will recheck my hardware then, since the problem is not in my code.

    Well, you only posted the initialization, which seems correct.

    But maybe there is a problem with interpreting the results when doing the combined sequence (in opposition to the apparently working single conversion operation).

**Attention** This is a public forum