Other Parts Discussed in Thread: MSP430G2553
Hello:
I have a problem when converting Vcc voltage using launchpad msp430g2553 channel 11 ADC10 mux.
My reading is not stable even if Vcc is. Most times the conversion reads 3.2v which is ok, but other times it reads e.g. 2.19v which is NOT ok. When I the USB cable to power lauchpad the problem is not noticeable but when I use my 3.2v regulator it shows. Bessides reading Vcc I also read a voltage of an external voltage that is always ok. This is a sample of my readings:
3.210165
2.195976 ß--- wrong read
3.20157
3.20157
3.197273
3.192975
2.47101 ß--- wrong read
3.188678
3.184381
3.184381
3.180083
3.180083
3.175786
3.171488
3.167191
3.162894
2.195976 ß--- wrong read
…
This is my code:
ADC10CTL0 |= REF2_5V + SREF_1 + REFON;
//for(n=0;n<100;n++);
ADC10CTL1 |= INCH_11; // VCC channel
for(n=0;n<20;n++); ///90 uS wait
times=17;
while (times--) {
ADC10CTL0 |= ADC10SHT_2 + ADC10ON + ADC10IE;
for(n=0;n<10;n++);
ADC10CTL0 |= ENC + ADC10SC;
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3, enable interrupts
__no_operation();
ADC10CTL0 &= ~(ENC);
//ADC10CTL0 &= ~(ADC10ON);
// ADC10CTL0 &= ~(REFON); // ADC10 disabled
tempValue += ADCResult;
}
sendData.VCCValue = tempValue>>4;
ADC10CTL1 = 0x0000;
ADC10AE0 |= 0x10; // P1.5 ADC10 option select analog enable
ADC10CTL1 |= INCH_4;
// Read Vstorage get circuit ready
P2OUT |= 0x10
ADC10CTL0 = ADC10SHT_2 + ADC10ON + ADC10IE;
ADC10CTL0 |= ENC + ADC10SC;
__bis_SR_register(LPM3_bits + GIE); // Enter LPM3, enable interrupts
__no_operation();
//Read Vstorage circuit down
P2OUT &= ~0x10
ADC10CTL0 &= ~(ENC);
ADC10CTL0 &= ~(ADC10ON);
ADC10CTL0 &= ~(REFON); // ADC10 disabled
ADC10CTL1 = 0x0000;
My second read in channel 4 is always ok. The problems is only when I read Vcc. Vcc is very stable during reading. I’m running out of ideas. Anyone has any clue to what is happening?